menu_tree

Versions
4.6 – 5
menu_tree($pid = 1)
6
menu_tree($menu_name = 'navigation')
7
menu_tree($menu_name)

Render a menu tree based on the current path.

The tree is expanded based on the current path and dynamic paths are also changed according to the defined to_arg functions (for example the 'My account' link is changed from user/% to a link with the current user's uid).

Parameters

$menu_name The name of the menu.

Return value

The rendered HTML of that menu on the current page.

Related topics

▾ 3 functions call menu_tree()

menu_block_view in modules/menu/menu.module
Implement hook_block_view().
shortcut_renderable_links in modules/shortcut/shortcut.module
Returns an array of shortcut links, suitable for rendering.
system_block_view in modules/system/system.module
Implement hook_block_view().

Code

includes/menu.inc, line 859

<?php
function menu_tree($menu_name) {
  $menu_output = &drupal_static(__FUNCTION__, array());

  if (!isset($menu_output[$menu_name])) {
    $tree = menu_tree_page_data($menu_name);
    $menu_output[$menu_name] = menu_tree_output($tree);
  }
  return $menu_output[$menu_name];
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.