function menu_router_build

Collects and alters the menu definitions.

Related topics

2 calls to menu_router_build()
menu_get_router in drupal/includes/
Gets the menu router.
menu_rebuild in drupal/includes/
Populates the database tables used by various menu functions.


drupal/includes/, line 2808
API for the Drupal menu system.


function menu_router_build() {

  // 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);
  list($menu, $masks) = _menu_router_build($callbacks);
  return array(