function menu_tree

You are here

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

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

2 calls to menu_tree()
menu_block in modules/menu/menu.module
Implementation of hook_block().
user_block in modules/user/user.module
Implementation of hook_block().
2 string references to 'menu_tree'
drupal_common_theme in includes/common.inc
Provide theme registration for themes across .inc files.
menu_tree_output in includes/menu.inc
Returns a rendered menu tree.

File

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

Code

function menu_tree($menu_name = 'navigation') {
  static $menu_output = 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];
}

Comments

I just tested this for drupal 6 on a custom menu but it may be helpfull:
If you have multiple languages on your website and your theme is calling this function, you may use the i18nmenu_translated_tree('menu_name') instead, wich will bring your translated menu...

Of course you need internationalization module and enabled translated menus...