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.
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 