I've defined a few routes with hook_menu()
, and added these routes to a menu with nesting. This works fine for all static routes, but for any route with a wildcard the 'active-trail' does (understandably) not apply to the menu, and the parent menu item is collapsed. How can I enforce that the parent menu item is open and has 'active-trail' class?
This is the hook_menu()
implementation I am using.
function my_module_menu() {
$items['parent'] = array(
'title' => t("Parent"),
'page callback' => 'my_module_parent',
'access callback' => 'user_is_logged_in',
);
$items['parent/child'] = array(
'title' => t("Child"),
'page callback' => 'my_module_child',
'access callback' => 'user_is_logged_in',
);
$items['parent/child/%'] = array(
'title' => t("Child Item"),
'page callback' => 'my_module_child_item',
'access callback' => 'user_is_logged_in',
'page arguments' => array(2)
);
return $items;
}
My menu (a custom menu) looks like the following.
- Home
- Item 1
- Item 2
- Parent
- Child
So if I go to 'parent/child/123' I want the 'parent' and 'child' menu items to be active and not collapsed.
I've tried the Menu Trail by Path module, but it seems to have no effect.