Closed (duplicate)
Project:
Drupal core
Version:
7.0
Component:
menu system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Feb 2011 at 10:24 UTC
Updated:
14 Feb 2011 at 19:42 UTC
The active trail of a menu system is not currently expanded, which is default behaviour in Drupal 6, and when not enabled means that the only time a menu is expanded is when it is set to expanded in the menu item.
Line 1040 of menu.inc
if ($data['link']['href'] == $router_item['tab_root_href'] && $data['link']['href'] != $_GET['q']) {
$data['link']['localized_options']['attributes']['class'][] = 'active';
}
Should be something like this
if ($data['link']['href'] == $router_item['tab_root_href'] && $data['link']['href'] != $_GET['q']) {
$data['link']['localized_options']['attributes']['class'][] = 'active';
$data['expanded'] = TRUE;
}
And then it works brilliantly!
Comments
Comment #1
NewZeal commentedOK so my solution was not what is needed and I am yet to find out exactly where the active class is applied to the anchor tag. If I make all the menu items expanded then active trail is no longer applied so I cannot control visibility using css.
Basically I cannot see how to make a menu display an expanded menu trail for the active trail in Drupal 7.
If I disable the query condition below on line 1357 of menu.inc then I can get all my child items showing and have an active class to use to theme it with:
Comment #2
berdirThis is probably a duplicate of #942782: Custom menus never receive an active trail.
Comment #3
NewZeal commentedYes, looks like you are correct. Hopefully this will be gone in 7.1.