Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi!
I am not sure if this is a bug, or is the intended functionality (in which case this becomes a feature request):
I have a menu item that points to a views-generated page. I've enabled the option to display the current node in the breadcrumbs, so I was expecting the link to appear, but it didn't.
A different menu item that points to a regular page works fine.
Is there any way to get it to work with a view?
Comment | File | Size | Author |
---|---|---|---|
#32 | 275622-mb_theme_reroll_NEEDS_REVIEW.patch | 1.81 KB | xurizaemon |
#26 | mb_theme.patch | 1.77 KB | jweowu |
#24 | 275622_200907121705-0400.patch | 903 bytes | sammys |
#18 | menu_breadcrumb.module.txt | 4.99 KB | avior |
#8 | menu_breadcrumb.patch | 1.54 KB | webrascal |
Comments
Comment #1
teecee CreditAttribution: teecee commentedI have the same problem, I have Views and taxonomy/term/XXX aliased pages in my menu. Any plan to be able to get these contents to this nice breadcrumbs menu?
Thanks!
Comment #2
japanitrat CreditAttribution: japanitrat commentedI removed the manually assigned menu-item and enabled the menu-item on the views admin-page right below path. This fixed it.
Comment #3
MindiL CreditAttribution: MindiL commentedSo close to perfect... but my views are secondary items off of Primary Links. I could have worked around this in 5, but am not seeing it in 6. Any tips?
Comment #4
PeteS CreditAttribution: PeteS commentedIt seems like
hook_init()
fires before the view's page code gets executed, which means the view has not calleddrupal_set_title()
yet. (I don't think changing the module weight helps in this case, but I could be wrong.) I'm wondering if there is some other hook that can be used (other thanhook_init()
) that would grab the page title after it has been set by the view (or any other module that is not a node but is setting the page title afterhook_init()
is fired.)Comment #5
PeteS CreditAttribution: PeteS commentedFor those who can't use #2 because they don't want the view page in the menu, this temporary solution is working for me. (And of course, any simpler solution/fix would be much appreciated.)
First, I put a
return;
inmenu_breadcrumb_init()
after it deals with themenu_breadcrumb_determine_menu
variable.Then, I copied all of the code after that point in
menu_breadcrumb_init()
and copied it into a new<em>module</em>_preprocess_page(&$variables)
function (you can put it into menu_breadcrumb.module as a quick-fix and call it menu_breadcrumb_preprocess_init, or dump it into your own module).This allows for
drupal_set_breadcrumbs()
to be called after Views has done its thing, but before the page is rendered. There's one more step.<em>module</em>_preprocess_page()
runs before the page is rendered but after the theme$variables
are rendered. So you'd need to manually update the breadcrumb variable, like so:$variables['breadcrumb'] = theme('breadcrumb', drupal_get_breadcrumb());
(That would go at the bottom of the
<em>module</em>_preprocess_page()
function that you've defined.)Note also that once you make the preprocess function, you'll have to go to the module and/or theme configuration page to get Drupal to reparse the module files for the existence of the preprocess function.
Like I said, this was a very quick fix for me because I'm under a project deadline to make the breadcrumbs work with Views, and I prefer being able to have the checkbox from menu_breadcrumb to control whether the page title is added to the breadcrumbs as opposed to having to modify my template file for every new project. Assuming I'm not missing some fatal flaw with this strategy, the code breadcrumb-specific code from
menu_breadcrumbs_init()
could just be moved into a new<em>module</em>_preprocess_page()
function.Either way, I'm not sure the breadcrumb stuff can happen in
hook_init
, so either try my suggestion, or if you have a better approach/refinement to the above, I'd love to hear it.Comment #6
webrascal CreditAttribution: webrascal commentedThanks PeteS.
I've gone and rolled a patch file to a similar end as your suggestions.
Works for us :)
Comment #7
webrascal CreditAttribution: webrascal commentedA quick addition to fix up html entities being double processed and rendered when displaying the current page as a link in the breadcrumb.
Comment #8
webrascal CreditAttribution: webrascal commentedOnce more!
My html entities fix wasn't entirely right as I misunderstood the issue.
This fix is more appropriate.
Comment #9
dnewkerk CreditAttribution: dnewkerk commentedFollowing the applying patches instructions, this patch failed to apply for me. Using Drupal 6.10, Menu Breadcrumbs 6.x-1.1 (current release).
Here's my console output when running patch -p0 < menu_breadcrumb_7.patch:
Or if I run patch < menu_breadcrumb_7.patch:
Content of menu_breadcrumb.module.rej:
Comment #10
dnewkerk CreditAttribution: dnewkerk commentedI opened the patch and applied the changes by hand on a clean copy of the module, and it had no effect (there is no visible effect of any change to the module's behavior so far as I can tell). I cleared all caches and the theme registry to be sure. I "think" the normal behavior of the module is still fine (e.g. nodes in the menu show a menu-based breadcrumb trail), but there is no effect on breadcrumbs of Views pages in the same menu.
Hope this helps.
Comment #11
PeteS CreditAttribution: PeteS commentedIs it possible that you need to go to the modules/themes administration page(s) after applying the patch, in order for Drupal to reparse the module to see that it now has a preprocess function? I'm not sure where that kind of data gets cached so clearing the cache/the cache tables may not cut it (while loading the themes/modules pages cause certain other pieces of internal data to get reset.)
Comment #12
webrascal CreditAttribution: webrascal commentedSorry for the delay in following this up.
I'll look into it as soon as I can and push out a verifiable patch to go with the latest release.
Comment #13
pelicani CreditAttribution: pelicani commentedWe were able to manually move Patch 7 (comment #8) into the menu breadcrumb.
We did have to the module and theme admin pages to resave our settings to get the preprocess function to fire. (comment #11)
However, we are still having problems seeing the complete breadcrumb when on a view page.
But on a node page the menu works completely.
For example, if we have 4 levels in our menu and the last level is a node, the breadcrumb works fine.
But if we are on the 3rd level, which is a view, the breadcrumb is incomplete.
Sometimes it will display a blank second item.
Or it may only have Home and the current.
Comment #14
pelicani CreditAttribution: pelicani commentedit works for views pages if the views are built correctly.
The views which create problems are the views accepting arguments.
The page view url needs a % where the arg is expected.
Even if there aren't any args afterwards. i.e. listing/%
Also, I had to hide the page when no arguments are present.
The setting for the argument sets what to do if no argument is present.
These two changes fixed #13.
NOTE: I manually patched the latest menu_breadcrumb
Comment #15
pbeakley CreditAttribution: pbeakley commentedThis may be related: I just installed this module and it works fine even when it's on a Views-built page. For example, I rebuilt the /blog page in Views so I could rename the blog to be something other than "Blogs." So, for example, when viewing www.mysite.com/blog, it displays Home >> About >> My Cool Blog. Great.
However, when I go to a specific entry, it reverts "My Cool Blog" back to plain old "Blogs". It also doesn't nest correctly. So, for example, when I go to "Entry One", what I want is:
Home >> About >> My Cool Blog >> Entry One
...but what I get is:
Home >> Blogs >> Username's Blog
Bummer.
Related or should I start a fresh ticket for this?
p.
Comment #16
wexy CreditAttribution: wexy commentedI solved this problem (at least for now I don't see any issues) by entering taxonomy/term/xx link instead of my alias section/category links for menu items that point to views page that emulates taxonomy listings.
Comment #17
wesayso CreditAttribution: wesayso commented@Keyz:
The problem is the menu_breadcrumb.module file doesn't end in a newline, and the patch tries to reference that incomplete line. If you add a newline (i.e. a blank line) to the end of menu_breadcrumb.module before applying the patch, it'll work.
Comment #18
avior CreditAttribution: avior commentedThe patch failed
I have patched manually and works great for me ,
thank you !
note that views that have arguments must set the view path to hold the argument with %
.i.e news/%
Thanks again
here is the patched file attached for ver 1.1
Comment #19
rismondo CreditAttribution: rismondo commentedsubscribing
Comment #20
I am learning CreditAttribution: I am learning commentedI applied the patch successfully and reapplied the theme. My Primary Menu structure is as follows:
About us (Page Node)
Structure (View Page)
History (Page Node)
When I'm at the bottom it comes perfectly:
Home » About us » Structure » History
but when I'm at Structure (the view page), it comes as:
Home » Structure
It is missing About us in between.
Is there anything I missed?
Thanks
Comment #21
xarbot CreditAttribution: xarbot commentedsubscribed
Comment #22
PeteS CreditAttribution: PeteS commentedrajoo.sharma: Is the View page (Structure) in the Primary Links menu because of the Menu setting within the View page display itself, or because a link was manually added to the menu that points to the view page URL? If it's the last one, that would be one reason I can think of that it wouldn't work.
Comment #23
I am learning CreditAttribution: I am learning commentedThanks Pete,
The view is a sublink, so it can not be added directly in view page, I had to add it in the primary menu.
Regards,
Comment #24
sammys CreditAttribution: sammys commentedI've updated the patch to apply to HEAD. The first hunk failed because that change is already in HEAD. Also had to change the patch to accept the missing newline at the end of the file. I'm marking it 'needs review'. Don't have time to read if it still needs other work to be worthy for committing. Sorry maintainer(s). :)
Comment #25
jweowu CreditAttribution: jweowu commentedsammys: Your patch doesn't remove the preprocess code from menu_breadcrumb_init(). I just looked at HEAD in the CVS browser, and that code is still in there (not surprising if the preprocess function hasn't been committed yet), so the patch does need to remove it.
I'm actually curious as to why menu_breadcrumb_preprocess() was used (with a consequent check for $hook == 'page') rather than menu_breadcrumb_preprocess_page() (suggested in #5, and which is called automatically for the 'page' hook). What was the reason for that? It seems cleaner to have all page preprocessing in *_preprocess_page() functions, if possible.
EDIT: deleted some totally incorrect nonsense that I'd written.
Comment #26
jweowu CreditAttribution: jweowu commentedRolled a new version of this patch, based on #5 and tested by myself in #556552: Menu weights, black/white list, and memory of menu selection
Comment #27
Maroli CreditAttribution: Maroli commentedDoes this piece of code also solves the issue related to views with arguments?
Comment #28
Maroli CreditAttribution: Maroli commentedOk. Got it to work with the latest CVS version.
Now I have a new question. Is it possible to have the link clicked on the view page added to the breadcrumb? For example: I have a view listing members of a club. Every member has a node on which more information regarding his company is given. I do want to have the name added to the the breadcrumb, together with the name of the view page.
How to achiev this?
Comment #29
jweowu CreditAttribution: jweowu commentedSee here:
http://drupal.org/node/496230
Comment #30
loominade CreditAttribution: loominade commentedsubscribing
Comment #31
xurizaemon@jweowu, on looking at the patch in #26 today, I think it must need to be taken with another of your associated issues from #556552: Menu weights, black/white list, and memory of menu selection.
#26 here removes drupal_set_breadcrumb(). Is that what you intended?
Comment #32
xurizaemonthis version applies cleanly on HEAD currently (update of patch from #26, which was complaining about reversed patch despite not having been applied). however i think i'm seeing no menu breadcrumbs after a quick test, so i've named the patch NEEDS_REVIEW as well :)
Comment #33
jweowu CreditAttribution: jweowu commentedI'll re-visit this when I get a chance.
Leaving out
drupal_set_breadcrumb()
was on purpose. If all the processing is done inhook_init()
, then you need to call it so that thedrupal_get_breadcrumb()
in theme.inc retrieves the right thing, but with this patch, the processing happens subsequent totemplate_preprocess_page()
, so I was thinking that there shouldn't be any need to 'set' the breadcrumb again.Thinking about it now, the theme itself may also wish to call
drupal_get_breadcrumb()
and make more changes, so yeah, it should still set it.Oh, and something that I realised during the menu weights work is that this patch effectively stops menu_breadcrumb from working with books. The problem is that book.module calls
menu_set_active_menu_name()
afterhook_init()
, and ifdrupal_set_breadcrumb()
hasn't been called already, then Drupal does amenu_get_active_breadcrumb()
using the menu that book.module set.Glancing at the code, maybe we could call
drupal_set_breadcrumb()
inhook_init()
to circumvent that, but defer the rest untilmenu_breadcrumb_preprocess_page()
? Or does that defeat the purpose of this patch? I'd need to test it to find out.Something to keep in mind, at any rate.
Comment #34
loominade CreditAttribution: loominade commentedthis works for me. thanks
Comment #36
FiNeX CreditAttribution: FiNeX commentedWould this patch fix http://drupal.org/node/618700#comment-2531350 ?
Comment #37
Wolfgang Reszel CreditAttribution: Wolfgang Reszel commentedThe patches produce an empty breadcrumb between home and the view name, so I had to modify the code:
Sorry, I don't know about creating patches.
Comment #38
selinav CreditAttribution: selinav commentedHello,
I use the version 6.x-1.3, and it doesn't work for views, what patch should I apply?
Thanks in advance.
Comment #39
allforabit CreditAttribution: allforabit commentedJust disable the navigation menu in the breadcrumb settings page and it'll work for views.
Comment #40
selinav CreditAttribution: selinav commentedI've disabled the navigation menu, and it still doesn't work for views...
Comment #41
nedjoCould regenerate breadcrumbs in hook_views_pre_view().
Comment #42
nedjoMenu breadcrumb currently sets breadcrumbs for all pages in hook_init(). Currently other modules can override specific breadcrumbs later in the page generation process. E.g., in hook_nodeapi(), menutrails sets breadcrumbs based on a parent menu item by node type or node taxonomy term. Moving menu breadcrumb's breadcrumb setting to hook_preprocess_page() would break this, so hook_views_pre_view() might be preferable, though it might not resolve non-Views issues.
Comment #43
selinav CreditAttribution: selinav commentedCan you give me more details about #41 and #42? How can I do it?
Comment #44
agerson CreditAttribution: agerson commentedsubscribe
Comment #45
xurizaemonComment #46
drupalxykon CreditAttribution: drupalxykon commented39 works, but it prints the view name instead of the menu name. This isn't practical, for a view with arguments where the same view is used for different menu items based on arguments.
Comment #47
kingandy CreditAttribution: kingandy commented#39 doesn't work for me. Creating a menu item for the view did, but it's not really what I was looking for...
Comment #48
zuza CreditAttribution: zuza commentedI have not tried to use patches, I tested solutions like #2. Nothing worked until I disabled breadcrumbs coming with Menu Trails module (enabled by default when this module is installed, so check this).
Now it works. But I have menu entry created for view page with view admin panel in Navigation menu, then manually disabled... Confusing.
Comment #49
arski CreditAttribution: arski commentedsub
Comment #50
knalstaaf CreditAttribution: knalstaaf commentedSubscribe.
Comment #51
capoyeti CreditAttribution: capoyeti commentedsubscribe
Comment #52
nadu CreditAttribution: nadu commentedIf you use views with path taxonomy/term/%, set "Action to take if argument is not present" of Term ID argument settings to "Hide view / Page not found (404)" then Menu Breadcrumb will work.
Comment #53
taitai CreditAttribution: taitai commentedI am using views 7.x.3.6. This is a related issue concerns tokens in views page title.
Views will allow you to insert tokens in the page title, however, views will append a linked page title in a hook that occurs after menu breadcrumbs.
This will cause a linked token symbol to be appended to the current page title in the breadcrumb
This is done in views_plugin_display_page and you comment out this line: $this->view->get_breadcrumb(TRUE);
in order to prevent views doing this.
Not a real fix, just an emergency
Comment #54
xurizaemonCleaning up issue queue. Closing all D6 issues.
If you believe this issue still applies to a supported version, feel free to re-open it. That would be a great time to check if the issue contains clear steps for reproducing the bug!
Thanks and sorry for any inconvenience.