function menu_ui_get_menus

menu_ui_get_menus($all = TRUE)

Return an associative array of the custom menus names.

Parameters

bool $all: (optional) If FALSE return only user-added menus, or if TRUE also include the menus defined by the system. Defaults to TRUE.

Return value

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

File

core/modules/menu_ui/menu_ui.module, line 478
Allows administrators to customize the site's navigation menus.

Code

function menu_ui_get_menus($all = TRUE) {
  if ($custom_menus = Menu::loadMultiple()) {
    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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!menu_ui!menu_ui.module/function/menu_ui_get_menus/8.1.x