menu_get_menus

Versions
6 – 7
menu_get_menus($all = TRUE)

Return an associative array of the custom menus names.

Parameters

$all If FALSE return only user-added menus, or if TRUE also include the menus defined by the system.

Return value

An array with the machine-readable names as the keys, and human-readable titles as the values.

▾ 7 functions call menu_get_menus()

menu_block_info in modules/menu/menu.module
Implements hook_block_info().
menu_block_view in modules/menu/menu.module
Implements hook_block_view().
menu_configure in modules/menu/menu.admin.inc
Menu callback; Build the form presenting menu configuration options.
menu_edit_item in modules/menu/menu.admin.inc
Menu callback; Build the menu link editing form.
menu_form_alter in modules/menu/menu.module
Implements hook_form_alter(). Adds menu item fields to the node form.
menu_form_node_type_form_alter in modules/menu/menu.module
Implements hook_form_FORM_ID_alter() for the node type form. Adds menu options to the node type form.
menu_parent_options_js in modules/menu/menu.module
Page callback. Get all available menus and menu items as Javascript array.

Code

modules/menu/menu.module, line 713

<?php
function menu_get_menus($all = TRUE) {
  $system_menus = array_keys(menu_list_system_menus());
  $query = db_select('menu_custom');
  $query->addTag('translatable');
  $query->addField('menu_custom', 'menu_name', 'menu_name');
  $query->addField('menu_custom', 'title', 'title');
  if (!$all) {
    $query->condition('menu_name', $system_menus, 'NOT IN');
  }
  $query->orderBy('title');

  return $query->execute()->fetchAllKeyed();
}
?>
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.