menu_router_build

Versions
6
menu_router_build($reset = FALSE)
7
menu_router_build()

Collect, alter and store the menu definitions.

Related topics

▾ 1 function calls menu_router_build()

menu_rebuild in includes/menu.inc
(Re)populate the database tables used by various menu functions.

Code

includes/menu.inc, line 1705

<?php
function menu_router_build($reset = FALSE) {
  static $menu;

  if (!isset($menu) || $reset) {
    // We need to manually call each module so that we can know which module
    // a given item came from.
    $callbacks = array();
    foreach (module_implements('menu') as $module) {
      $router_items = call_user_func($module .'_menu');
      if (isset($router_items) && is_array($router_items)) {
        foreach (array_keys($router_items) as $path) {
          $router_items[$path]['module'] = $module;
        }
        $callbacks = array_merge($callbacks, $router_items);
      }
    }
    // Alter the menu as defined in modules, keys are like user/%user.
    drupal_alter('menu', $callbacks);
    $menu = _menu_router_build($callbacks);
    _menu_router_cache($menu);
  }
  return $menu;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.