function menu_tree

7.x menu.inc menu_tree($menu_name)
5.x menu.inc menu_tree($pid = 1)
6.x menu.inc menu_tree($menu_name = 'navigation')

Renders 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

A structured array representing the specified menu on the current page, to be rendered by drupal_render().

Related topics

3 calls to menu_tree()
menu_block_view in drupal/modules/menu/menu.module
Implements hook_block_view().
shortcut_renderable_links in drupal/modules/shortcut/shortcut.module
Returns an array of shortcut links, suitable for rendering.
system_block_view in drupal/modules/system/system.module
Implements hook_block_view().
2 string references to 'menu_tree'
drupal_common_theme in drupal/includes/common.inc
Provides theme registration for themes across .inc files.
menu_reset_static_cache in drupal/includes/menu.inc
Resets the menu system static cache.

File

drupal/includes/menu.inc, line 1002
API for the Drupal menu system.

Code

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];
}