Download & Extend

Allow to toggle display of current menu item in breadcrumb

Project:Menu Trails
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

In the breadcrumbs on my site, the active menu item is also in the breadcrumbs. I'm using menutrails 6.x-1.0 (but I tried dev as well), "Menutrails Menu" = Primary links, "Set breadcrumbs?" = checked, the parent item of this node type is set to ''. I'm using a Zen based theme, but Garland does the same.

For instance: I have a node called 'Products'. The path alias is 'products' and the menu item's title is 'Products' as well. This produces the following breadcrumbs: "Home > Products", where 'Products' is derived from the menu item (I tested this by changing the menu item title). This means that the breadcrumbs contain a link to the current page, which is not the correct behaviour I suppose. The same happens on child nodes: The 'Shirts' page (path: 'products/shirts', menu item: 'Shirts') produces "Home > Products > Shirts" as breadcrumb.

Comments

#1

I am also seeing the same problem. I am using zen and when I select "set breadcrumbs" on the menu trail administration page I get the current menu item active in the breadcrumbs. I also have the "append the content title to the end of the breadcrumb" selected on the theme page so when I go to a node i have this "home > people > people" in the breadcrumb. Where the first people breadcrumb item is active and is a link. When I should just have "home > people" with people inactive. In general if I turn off the "append the content title to the end of the breadcrumb" on the theme settings page I would normally have just "home" in the breadcrumbs and not the current page that i am on. I should also probably note that I don't have a parent item set for this content type because it sits in the menu normally.

#2

Could you please test whether this bug also occurs in a different theme than Zen*?

#3

I just did a quick test on garland, and the active node still displays in the breadcrumb as a link. It doesn't get the double breadcrumb "home > people > people" which is definitely just a combination of zen and menu trail. Now that I think about it, is the active node supposed to be in the breadcrumb as a link? Even if it doesn't have a parent menu item selected for it on the menu trail admin?

#4

I think there are a couple of intersecting issues here. As I understand menutrails, it implements a decision to have a link to the current node as the last item in the breadcrumb. By contrast, the Zen theme (and possibly others) implement a decision to add the title of the current node in plain text as the last item in the breadcrumb. Thus if one uses both together, one ends up with the title of the current node as a link, followed by the same text in plain text at the end of one's breadcrumb.

Clearly that is not desirable, but it is an open question as to whether the last item in the breadcrumb should be a link or plain text.

If one wants plain text, one can modify menutrails by commenting out the line which reads

$crumbs[] = l($menu_item['link']['link_title'], $menu_item['link']['link_path']);

in the _menutrails_recurse_crumbs function.

Alternatively, if one wants the link, one could override and modify the zen_preprocess_page function, found in Zen's version of template.php, to remove the following lines:

  // Add an optional title to the end of the breadcrumb.
  if (theme_get_setting('zen_breadcrumb_title') && $vars['breadcrumb']) {
    $vars['breadcrumb'] = substr($vars['breadcrumb'], 0, -6) . $vars['title'] . '</div>';
  }

One possible approach to this set of issues would be to modify menutrails by giving it settings for something like the following options: include node title in breadcrumb; make node title link or plain text. This would cover most cases, but would still not be adequate to have the current node's title as a link if one were also using Zen (without modifying Zen as indicated above).

#5

Thanks Sid_M!

I had the same issue and your suggestion worked really well to me.

#6

This issue I am hainvg with this is that pages, which all belong to some part of a menu has the page title doubled when I am not using the menu trails for it. However, terms and children of that term I am using menu trails and work as expected. If a node has neither a content type nor a term that is being used by menu trail, why would it be adding this link in the breadcrumb?

#7

PS. I am also using the Menu breadcrumb so pages on the primary menu have a breadcrumb.

#8

One possible approach to this set of issues would be to modify menutrails by giving it settings for something like the following options: include node title in breadcrumb; make node title link or plain text.

I second that, I never want to show the active page title as a link in the breadcrumbs, no matter what theme I'm using.

I am using this with the Menu Breadcrumb module, which has settings like the ones mentioned by Sid_M. Mirroring the settings for this module would make it easier for the two modules to work together.

#9

A patch to turn this into a configurable setting would be welcome.

#10

Title:Current menu item in breadcrumbs» Allow to toggle display of current menu item in breadcrumb
Category:bug report» feature request

#11

I am using this with the Menu Breadcrumb module, which has settings like the ones mentioned by Sid_M. Mirroring the settings for this module would make it easier for the two modules to work together.

I started work on a patch for this... and I was copying / pasting chunks of code from menu_breadcrumb, until I realized it's perhaps worth trying to combine the two modules. Please take a look at #560464: Consider merging with menutrails if you're interested.

nobody click here