function menu_ui_get_menus
Same name in other branches
- 9 core/modules/menu_ui/menu_ui.module \menu_ui_get_menus()
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.
2 calls to menu_ui_get_menus()
- menu_ui_form_node_type_form_alter in core/
modules/ menu_ui/ menu_ui.module - Implements hook_form_FORM_ID_alter() for \Drupal\node\NodeTypeForm.
- WizardPluginBase::buildForm in core/
modules/ views/ src/ Plugin/ views/ wizard/ WizardPluginBase.php - Form callback to build other elements in the "show" form.
File
-
core/
modules/ menu_ui/ menu_ui.module, line 442
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.