By AngeloFallein on
I work with Drupal 7. I have a view news with an overview of nodes with content type news. The view news has a menu item in the main menu.
When I go to the view news via the main menu the menu link news is highlighted. I would like to highlight main menu link news also when I visit a news item page.
But i can't find a solution for drupal 7.
I need something that sets menu item news active when I view a node with content type news.
Module menu trails has no Drupal 7 version, Context module doesn't work because I have no context entry in menu structure. Are there other solutions? Maybe via code or other modules.
Comments
Solved
Set parent menu item news to "view" news.
Style the .active-trail class as active in the main menu.
Hi, it seems I have exactly
Hi, it seems I have exactly the same problem but unfortunately I'm not sure what you mean with the "Set parent menu item news to "view" news."
Can you explain it little bit for me? Thank you!
working solution
- Edit your view called news
- Click on "+" near arguments and choose "Node: Title" keeping all default values
- Save your view
- Using pathauto module, define the pattern for all "news" content type to news/[node:title]
- edit all your "news" content types and check "automatic URL" to update their url.
Thats all
https://www.jbfelix.be
not solved
Hi, I have the same problem.
I don't understand "Set parent menu item news to "view" news." and the "Working solution" don't work for me.
Additionaly, should I do something with the menus?
Thanks
Thanks for your reply! I
Thanks for your reply!
I resolved this problem using "themename_menu_link" function in my template.php file.
I can post a snippet if someone interested.
i'd like to
could you post the snippet?
My snippet for main-menu and
My snippet for main-menu and node type 'article'
Doesn't seem to work
I was really hoping that "working solution" would do just that because this issue is preventing me from migrating from Drupal 6 to Drupal 7, but it doesn't work - or at least I haven't been able to make it work (no "active" or "active-trail" classes when displaying the menu-less node).
In the past I've used Node Breadcrumb to maintain navigational context but this hasn't been updated for D7 yet - and it never made it beyond beta for D6 so I don't expect a D7 version any time soon.
Any other suggestions?
Really solved
For anyone else struggling with this in D7 try the Menu Position module. Early days but it seems to meet the need perfectly.
Context
The context module has an option to set the active item. So you can just set the Condition to a View or Node type (or both) and the Reaction has a menu option where you can specify the menu item to be active.
Very thanks @Boriss!
Very thanks @Boriss!
Unfortunately this only
Unfortunately this only updates the individual item selected and does nothing to create an active trail for parent items. I had high hopes for using context in this situation but this was pretty disappointing.
Jay Darnell - CivicActions
Web Designer / Developer / Illustrator
Can context set active trail for parent?
I am stuck on the same problem. Context neatly sets the class of my to active, but not the. Any thoughts now, two years later? Thanks.
Menu Position
Hi Gettysburger,
Take a look at Menu Position. Maybe this module can help you?