menu_enable

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 menu_enable()

Implementation of hook_enable()

Add a link for each custom menu.

▾ 1 function calls menu_enable()

system_update_6021 in modules/system/system.install
Migrate the menu items from the old menu system to the new menu_links table.

Code

modules/menu/menu.module, line 164

<?php
function menu_enable() {
  menu_rebuild();
  $base_link = db_fetch_array(db_query("SELECT mlid AS plid, menu_name from {menu_links} WHERE link_path = 'admin/build/menu' AND module = 'system'"));
  $base_link['router_path'] = 'admin/build/menu-customize/%';
  $base_link['module'] = 'menu';
  $result = db_query("SELECT * FROM {menu_custom}");
  while ($menu = db_fetch_array($result)) {
    // $link is passed by reference to menu_link_save(), so we make a copy of $base_link.
    $link = $base_link;
    $link['mlid'] = 0;
    $link['link_title'] = $menu['title'];
    $link['link_path'] = 'admin/build/menu-customize/' . $menu['menu_name'];
    if (!db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s' AND plid = %d", $link['link_path'], $link['plid']))) {
      menu_link_save($link);
    }
  }
  menu_cache_clear_all();
}
?>

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