I am getting same bug as these bug reports in Drupal 7.0
http://drupal.org/node/292584
http://drupal.org/node/251655
I've tried to find bug, but I wasn'ť succesful.
Problem is somewhere in drupal core, when loading full menu tree.
Link won't who because menu_tree() gets wrong data:
$data['below'] and $data['link']['in_active_trail'] are empty if you select menu.
I was unable to track data back further, someone with better knowledge of drupal menu system may be able to fix.
There is my temporary(nasty) workaround (I'm desperate and in need to continue on my project):
Replace this in includes/menu.inc line about 1054:
$element['#below'] = $data['below'] ? menu_tree_output($data['below']) : $data['below'];
by this:
if($data['link']['menu_name'] == 'YOUR-MENU-NAME')
{
$item = menu_get_item();
if($data['link']['href'] == $item['href'])
{
$element['#below'] = $data['below'] ? menu_tree_output($data['below']) : $data['below'];
}
else
{
$element['#below'] = array();
}
}
else
{
$element['#below'] = $data['below'] ? menu_tree_output($data['below']) : $data['below'];
}
And SET your parent menu item EXPANDED all time, it will be collapsed if is not selected.
!! WARNING: this code change will collapse all your menu tree if will not be selected it.
Comments
Comment #1
yoroy commentedNow that D7 is out, bug fixes are done in D8 first then possibly backported. Thanks for the report and links to similar issues.
Comment #8
dawehnerI doubt this still applies to D8.