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?


teecee’s picture

I 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?


japanitrat’s picture

I removed the manually assigned menu-item and enabled the menu-item on the views admin-page right below path. This fixed it.

MindiL’s picture

So 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?

PeteS’s picture

It seems like hook_init() fires before the view's page code gets executed, which means the view has not called drupal_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 than hook_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 after hook_init() is fired.)

PeteS’s picture

For 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; in menu_breadcrumb_init() after it deals with the menu_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.

webrascal’s picture

Assigned: Unassigned » webrascal
Status: Active » Needs review
1.51 KB

Thanks PeteS.

I've gone and rolled a patch file to a similar end as your suggestions.

Works for us :)

webrascal’s picture

1.53 KB

A quick addition to fix up html entities being double processed and rendered when displaying the current page as a link in the breadcrumb.

webrascal’s picture

1.54 KB

Once more!

My html entities fix wasn't entirely right as I misunderstood the issue.

This fix is more appropriate.

dnewkerk’s picture

Following 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:

(Stripping trailing CRs from patch.)
patching file menu_breadcrumb.module
Hunk #2 FAILED at 118.
1 out of 2 hunks FAILED -- saving rejects to file menu_breadcrumb.module.rej

Or if I run patch < menu_breadcrumb_7.patch:

(Stripping trailing CRs from patch.)
patching file menu_breadcrumb.module
Hunk #2 FAILED at 118.

Content of menu_breadcrumb.module.rej:

*** 135,138 ****
    return system_settings_form($form);
--- 118,142 ----
    return system_settings_form($form);
+ }
+ function menu_breadcrumb_preprocess(&$vars, $hook) {
+   if ($hook == 'page') {
+     $breadcrumb = drupal_get_breadcrumb();
+     if (variable_get('menu_breadcrumb_append_node_title', 0) == 1) {
+       if (variable_get('menu_breadcrumb_append_node_url', 0) == 1) {
+         $breadcrumb[] = l(drupal_get_title(), $_GET['q'], array('html' => true));
+       }
+       else {
+         $breadcrumb[] = drupal_get_title();
+       }
+     }
+     if (count($breadcrumb) == 1 && variable_get('menu_breadcrumb_hide_on_single_item', 0)) {
+       $breadcrumb = array();
+     }
+     $vars['breadcrumb'] = theme('breadcrumb', $breadcrumb);
+   } 
dnewkerk’s picture

Status: Needs review » Needs work

I 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.

PeteS’s picture

Is 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.)

webrascal’s picture

Sorry 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.

pelicani’s picture

We 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.

pelicani’s picture

it 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

pbeakley’s picture

This 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


Related or should I start a fresh ticket for this?


wexy’s picture

I 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.

wesayso’s picture


Hunk #2 FAILED at 118.

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.

avior’s picture

4.99 KB

The 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

rismondo’s picture


I am learning’s picture

I 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?

xarbot’s picture


PeteS’s picture

rajoo.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.

I am learning’s picture

Thanks 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.


sammys’s picture

Status: Needs work » Needs review
903 bytes

I'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). :)

jweowu’s picture

Status: Needs review » Needs work

sammys: 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.

jweowu’s picture

Version: 6.x-1.1 » 6.x-1.x-dev
Status: Needs work » Needs review
1.77 KB

Rolled 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

Maroli’s picture

Does this piece of code also solves the issue related to views with arguments?

Maroli’s picture

Ok. 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?

jweowu’s picture

loominade’s picture


xurizaemon’s picture

@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?

xurizaemon’s picture

this 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 :)

jweowu’s picture

Status: Needs review » Needs work

I'll re-visit this when I get a chance.

Leaving out drupal_set_breadcrumb() was on purpose. If all the processing is done in hook_init(), then you need to call it so that the drupal_get_breadcrumb() in theme.inc retrieves the right thing, but with this patch, the processing happens subsequent to template_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() after hook_init(), and if drupal_set_breadcrumb() hasn't been called already, then Drupal does a menu_get_active_breadcrumb() using the menu that book.module set.

Glancing at the code, maybe we could call drupal_set_breadcrumb() in hook_init() to circumvent that, but defer the rest until menu_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.

loominade’s picture

this works for me. thanks

FiNeX’s picture

Wolfgang Reszel’s picture

The patches produce an empty breadcrumb between home and the view name, so I had to modify the code:

 * theme('page') pre-processing.
function menu_breadcrumb_preprocess_page(&$vars) {
  $breadcrumb = drupal_get_breadcrumb();
  $index = '';
  if (empty($breadcrumb[count($breadcrumb)-1])) $index = count($breadcrumb)-1;  
  if (variable_get('menu_breadcrumb_append_node_title', 0) == 1) {
    if (variable_get('menu_breadcrumb_append_node_url', 0) == 1) {
      $options = array('html' => TRUE, 'attributes' => array('id' => 'menu-breadcrumb-title'));
      $breadcrumb[$index] = l(drupal_get_title(), $_GET['q'], $options);
    } else {
      $breadcrumb[$index] = '<span id="menu-breadcrumb-title">' . drupal_get_title() . '</span>';
  if (count($breadcrumb) == 1 && variable_get('menu_breadcrumb_hide_on_single_item', 0)) {
    $breadcrumb = array();
  $vars['breadcrumb'] = theme('breadcrumb', $breadcrumb);

Sorry, I don't know about creating patches.

selinav’s picture

Version: 6.x-1.x-dev » 6.x-1.3


I use the version 6.x-1.3, and it doesn't work for views, what patch should I apply?

Thanks in advance.

allforabit’s picture

Just disable the navigation menu in the breadcrumb settings page and it'll work for views.

selinav’s picture

I've disabled the navigation menu, and it still doesn't work for views...

nedjo’s picture

Could regenerate breadcrumbs in hook_views_pre_view().

nedjo’s picture

Menu 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.

selinav’s picture

Can you give me more details about #41 and #42? How can I do it?

agerson’s picture


xurizaemon’s picture

Version: 6.x-1.3 » 6.x-1.x-dev
drupalxykon’s picture

39 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.

kingandy’s picture

#39 doesn't work for me. Creating a menu item for the view did, but it's not really what I was looking for...

zuza’s picture

I 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.

arski’s picture


knalstaaf’s picture


capoyeti’s picture


nadu’s picture

If 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.

taitai’s picture

I 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