diff --git a/includes/menu.inc b/includes/menu.inc index c4fdaaa..db2329e 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -1006,7 +1006,7 @@ function menu_tree($menu_name, $skip_hidden = FALSE) { $menu_output = &drupal_static(__FUNCTION__, array()); if (!isset($menu_output[$menu_name])) { - $tree = menu_tree_page_data($menu_name, $skip_hidden); + $tree = menu_tree_page_data($menu_name, NULL, FALSE, $skip_hidden); $menu_output[$menu_name] = menu_tree_output($tree); } return $menu_output[$menu_name]; @@ -1830,23 +1830,29 @@ function menu_list_system_menus() { /** * Returns an array of links to be rendered as the Main menu. + * @param $skip_hidden + * (optional) Improve performance by skipping hidden menu links in tree + * see _menu_tree_check_access */ -function menu_main_menu() { - return menu_navigation_links(variable_get('menu_main_links_source', 'main-menu')); +function menu_main_menu($skip_hidden = FALSE) { + return menu_navigation_links(variable_get('menu_main_links_source', 'main-menu'), $skip_hidden); } /** * Returns an array of links to be rendered as the Secondary links. + * @param $skip_hidden + * (optional) Improve performance by skipping hidden menu links in tree + * see _menu_tree_check_access */ -function menu_secondary_menu() { +function menu_secondary_menu($skip_hidden = FALSE) { // If the secondary menu source is set as the primary menu, we display the // second level of the primary menu. if (variable_get('menu_secondary_links_source', 'user-menu') == variable_get('menu_main_links_source', 'main-menu')) { - return menu_navigation_links(variable_get('menu_main_links_source', 'main-menu'), 1); + return menu_navigation_links(variable_get('menu_main_links_source', 'main-menu'), 1, $skip_hidden); } else { - return menu_navigation_links(variable_get('menu_secondary_links_source', 'user-menu'), 0); + return menu_navigation_links(variable_get('menu_secondary_links_source', 'user-menu'), 0, $skip_hidden); } } @@ -1857,18 +1863,21 @@ function menu_secondary_menu() { * The name of the menu. * @param $level * Optional, the depth of the menu to be returned. + * @param $skip_hidden + * (optional) Improve performance by skipping hidden menu links in tree + * see _menu_tree_check_access * * @return * An array of links of the specified menu and level. */ -function menu_navigation_links($menu_name, $level = 0) { +function menu_navigation_links($menu_name, $level = 0, $skip_hidden = FALSE) { // Don't even bother querying the menu table if no menu is specified. if (empty($menu_name)) { return array(); } // Get the menu hierarchy for the current page. - $tree = menu_tree_page_data($menu_name, $level + 1); + $tree = menu_tree_page_data($menu_name, $level + 1, FALSE, $skip_hidden); // Go down the active trail until the right level is reached. while ($level-- > 0 && $tree) { @@ -2900,7 +2909,7 @@ function _menu_link_build($item) { /** * Builds menu links for the items in the menu router. */ -function _menu_navigation_links_rebuild($menu) { +function _menu_navigation_links_rebuild($menu, $skip_hidden = FALSE) { // Add normal and suggested items as links. $menu_links = array(); foreach ($menu as $path => $item) {