| Versionen | |
|---|---|
| drupal6 – drupal7 | menu_get_menus($all = TRUE) |
Return an associative array of the custom menus names.
$all If FALSE return only user-added menus, or if TRUE also include the menus defined by the system.
An array with the machine-readable names as the keys, and human-readable titles as the values.
modules/
<?php
function menu_get_menus($all = TRUE) {
$system_menus = menu_list_system_menus();
$sql = 'SELECT * FROM {menu_custom}';
if (!$all) {
$sql .= ' WHERE menu_name NOT IN (' . implode(',', array_fill(0, count($system_menus), "'%s'")) . ')';
}
$sql .= ' ORDER BY title';
$result = db_query($sql, $system_menus);
$rows = array();
while ($r = db_fetch_array($result)) {
$rows[$r['menu_name']] = $r['title'];
}
return $rows;
}
?>
Kommentare
Kommentar hinzufügen