diff --git includes/menu.inc includes/menu.inc index 642e946..c01ccf4 100644 --- includes/menu.inc +++ includes/menu.inc @@ -1095,6 +1095,27 @@ function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) { } /** + * Set the active item for menu trees. + */ +function menu_tree_set_item($item) { + return menu_tree_get_item($item['menu_name'], $item); +} + +/** + * Get the active item for the requested menu tree. + * + * @param $menu_name + * The menu name of the requested menu tree. + */ +function menu_tree_get_item($menu_name, $item = NULL) { + $items = &drupal_static(__FUNCTION__); + if (isset($item)) { + $items[$menu_name] = $item; + } + return $items[$menu_name]; +} + +/** * Get the data structure representing a named menu tree, based on the current page. * * The tree order is maintained by storing each parent in an individual @@ -1120,7 +1141,7 @@ function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = $tree = &drupal_static(__FUNCTION__, array()); // Load the menu item corresponding to the current page. - if ($item = menu_get_item()) { + if (($item = menu_tree_get_item($menu_name)) || ($item = menu_get_item())) { if (isset($max_depth)) { $max_depth = min($max_depth, MENU_MAX_DEPTH); }