Highlight current menu item
gollyg - March 3, 2007 - 13:09
| Project: | Custom Breadcrumbs |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
Whilst the breadcrumbs are behaving beautifully, the users location within the menu tree is not accurately reflected.
Currently my breadcrumb is reflecting the current location within the site, but the menu system is not. For example, I have an article that generates a breadcrumb "media > press releases" but the menu items leading to this page are not expanding as they should.
It may be the way I have it setup, if so i would be delighted ;) If not it would be an absolute killer module if this could be added.
Thanks for the hard work!

#1
I found that adding the following two lines to the end of the custom_breadcrumbs_nodeapi function made this work.
$menu_item = drupal_get_normal_path($paths[count($paths)-1]);menu_set_active_item($menu_item);
Sorry about not submitting a patch, but i have no idea about all of that stuff. one day. one day...
#2
I'm going to try this as an experimental option -- it will not work in all cases, depending on how the user's breadcrumb trail is set up, but I can definitely look into adding it.
#3
Perhaps giving the user a checkbox option of "highlight menu item" for each custom breadcrumb would deal with the cases in which it was undesirable? Thanks for looking into it.
#4
Hi,
I have been struggling with this same issue. The module creates breadcrumbs and displays them without a problem, but the menus don't expand accordingly.
I tried the modification suggested by gollyg, but it ended up creating other problems. Setting
menu_set_active_item()to something other than the current path caused the edit and view tabs to disappear when viewing nodes, since those tabs are local menu items that depend on the menu system's knowing what node we are viewing.However, I saw in this comment that dquakenbush used
menu_set_location()to do something similar, without the Custom Breadcrumbs modules.I just tried something similar here in the Custom Breadcrumbs module and it seems to work. This looks like the best way I have found to solve the problem of using pathauto for node aliases and having the menus expand based upon the alias assigned to the node. Really, it's the only way I have found that works.
I don't know if this module is the best place to do so or if, as Eaton suggests, it should be an optional feature, but it has solved a problem that has been making me crazy for the last few days!
#5
I just committed something very much like the patch in #4 to 5.x-1.x-dev.
#6
#7
Automatically closed -- issue fixed for 2 weeks with no activity.