Same name and namespace in other branches
  1. 5.x includes/menu.inc \menu_get_root_menus()

Retrieves the menu ID and title of all root menus.

Return value

Array containing all menus (but not menu items), in the form mid => title.

Related topics

3 calls to menu_get_root_menus()
menu_block in modules/menu.module
Implementation of hook_block().
menu_configure in modules/menu.module
Menu callback; presents menu configuration options.
menu_overview_tree in modules/menu.module
Present the menu tree, rendered along with links to edit menu items.

File

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

Code

function menu_get_root_menus() {
  $menu = menu_get_menu();
  $root_menus = array();
  foreach ($menu['items'][0]['children'] as $mid) {
    $root_menus[$mid] = $menu['items'][$mid]['title'];
  }
  return $root_menus;
}