menu_get_root_menus

Versions
4.7 – 5
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 functions call menu_get_root_menus()

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

Code

includes/menu.inc, line 295

<?php
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;
}
?>
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.