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

NewZeal’s picture

OK 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:

    if (!empty($parameters['expanded'])) {
      //$query->condition('ml.plid', $parameters['expanded'], 'IN');
    }
Berdir’s picture

Status: Active » Closed (duplicate)
NewZeal’s picture

Yes, looks like you are correct. Hopefully this will be gone in 7.1.