Enabling "set breadcrumbs" breaks breadcrumb on pages outside of Menu Trails Menu

tirdadc - May 12, 2009 - 15:15
Project:Menu Trails
Version:6.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

To duplicate this issue:

  • Create two hierarchical menus
  • Set one as the Menu Trails-enabled menu and configure it based on some criteria (in my case I was using a category)
  • Set up a page in the 2nd or 3rd level of the non-Menu Trails menu, you should see its breadcrumb work correctly at this point
  • Enable "set breadcrumbs" in Menu Trails, and your breadcrumb on the above page will be broken (you'll just get "Home")

This is due to how enabling "set breadcrumbs" results in a call of menutrails_get_breadcrumbs(), which simply goes ahead and overwrites the existing breadcrumb based on the enabled menu and the current page (by relying on menu_tree_page_data()) no matter what, even if the page in question belonged to another menu.

I think it would make much more sense to only have this override happen if the node is present in the enabled menu. Right now I've settled for a somewhat rudimentary solution that checks if the returned breadcrumb contains just "Home" and doesn't replace the existing value. It's hardly optimal and a better solution would be to improve menutrails_get_breadcrumbs() itself, but it had to do for now.

AttachmentSize
menutrails_breadcrumb.patch731 bytes

#1

tirdadc - May 12, 2009 - 15:17
Status:patch (to be ported)» active

Ugh, messed up the status.

#2

lesmana - August 24, 2009 - 17:12
Status:active» needs review

Actually, the status you're looking for is "needs review".

#3

lesmana - August 24, 2009 - 17:54

I can confirm the problem you describe, and the patch does fix it. I'm a little concerned about the second part of the conditional where you're doing string comparisons on the formatted "Home" link. It's pretty inflexible, and I'm not sure I can think of a situation where I'd necessarily want that check to be made.

#4

justin2pin - November 12, 2009 - 03:45

is there a reason we can't just remove the following (from line 136):

  else {
    return $item; // we may want to do some breadcrumbing
  }

Why would we want to do any breadcrumbing if menutrails isn't controlling the menu item?

 
 

Drupal is a registered trademark of Dries Buytaert.