menu_get_menus

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 menu_get_menus($all = TRUE)

Return an associative array of the custom menus names.

Übergabeparameter

$all If FALSE return only user-added menus, or if TRUE also include the menus defined by the system.

Rückgabewert

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

▾ 4 functions call menu_get_menus()

menu_block in modules/menu/menu.module
Implementation of hook_block().
menu_configure in modules/menu/menu.admin.inc
Menu callback; Build the form presenting menu configuration options.
menu_edit_item in modules/menu/menu.admin.inc
Menu callback; Build the menu link editing form.
menu_form_alter in modules/menu/menu.module
Implementation of hook_form_alter(). Adds menu item fields to the node form.

Code

modules/menu/menu.module, line 442

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

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen