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.
Hello...
I was trying to get a context to trigger an active menu trail that is 2 levels deep. Is this not possible? I have a menu item as such:
About us -> Blog -> [blog entries]
I created a context for node type of blog, and added in a breadcrumb reaction and the menu reaction to set the active trail to Blog. Doesn't work.... but then I saw the README file describing that issue.
Just confirming that this is indeed not possible?
Thanks
Comments
Comment #1
Mark TrappYou should be able to trigger an active menu trail 2 levels deep as long as Expand all children of this tree is checked. Does that not work for you?
If you're trying to do it without it checked, it is indeed not possible: the child menus aren't populated unless the parent menu is expanded so there's no way to traverse the menu tree.
Comment #2
bkosborneAhh makes sense ... Yeah I don't have that set unfortunately. I was hoping that the context would be savvy enough to expand the tree out to where I want the active trail to be, you know?
Oh well, hopefully the client doesn't complain.
Comment #3
safetypin@bkosborne, I was able to work around this problem by creating a unique menu block that was configured to "expand all children" that only displayed in the necessary "section". So, throughout most of the site, one menu_block was being shows that was not configured to expand all children, but in the sections where I needed to use contexts to trigger the menu, I had a different menu_block that was.
Comment #4
bkosborneYeah I believe that's how I went around the problem as well. It's messy, but seems to be the best solution available.
Comment #5
bkosborneI revist this after I saw a screencast by Node One on doing this using Rules and a couple other modules in D7. That screencast is here: http://nodeone.se/blogg/using-rules-to-set-active-menu-items
However, I'm working on a D6 build that again requires this functionality. I haven't tried it yet, but the features of this module claim to provide a work around for this very common problem people run into. I'll post back on my findings...
http://drupal.org/project/menutrails
Comment #6
Alice Heaton CreditAttribution: Alice Heaton commentedAs this is still an issue in Drupal 7, I thought I would point out that there is an easier work around: if you don't mind your menus actually being loaded, then you can simply hide the non active ones using CSS.
Something like this :
This works well for two levels. You'll need to add more rules if you have more levels.