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;
}
doc_Drupal
2016-10-29 09:27:51
Comments
Leave a Comment

Please login to continue.