function menu_get_menus

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.

10 calls to menu_get_menus()
MenuBlock::getDerivativeDefinitions in drupal/core/modules/menu/lib/Drupal/menu/Plugin/Derivative/MenuBlock.php
Implements \Drupal\Component\Plugin\Derivative\DerivativeInterface::getDerivativeDefinitions().
MenuLinkFormController::form in drupal/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php
Overrides EntityFormController::form().
MenuSettingsForm::buildForm in drupal/core/modules/menu/lib/Drupal/menu/MenuSettingsForm.php
Implements \Drupal\Core\Form\FormInterface::buildForm().
menu_form_node_form_alter in drupal/core/modules/menu/menu.module
Implements hook_form_BASE_FORM_ID_alter().
menu_form_node_type_form_alter in drupal/core/modules/menu/menu.module
Implements hook_form_FORM_ID_alter().

... See full list

File

drupal/core/modules/menu/menu.module, line 719
Allows administrators to customize the site's navigation menus.

Code

function menu_get_menus($all = TRUE) {
  if ($custom_menus = entity_load_multiple('menu')) {
    if (!$all) {
      $custom_menus = array_diff_key($custom_menus, menu_list_system_menus());
    }
    foreach ($custom_menus as $menu_name => $menu) {
      $custom_menus[$menu_name] = $menu
        ->label();
    }
    asort($custom_menus);
  }
  return $custom_menus;
}