function MenuLinkManager::rebuild

Same name in other branches
  1. 9 core/lib/Drupal/Core/Menu/MenuLinkManager.php \Drupal\Core\Menu\MenuLinkManager::rebuild()
  2. 10 core/lib/Drupal/Core/Menu/MenuLinkManager.php \Drupal\Core\Menu\MenuLinkManager::rebuild()
  3. 11.x core/lib/Drupal/Core/Menu/MenuLinkManager.php \Drupal\Core\Menu\MenuLinkManager::rebuild()

Overrides MenuLinkManagerInterface::rebuild

File

core/lib/Drupal/Core/Menu/MenuLinkManager.php, line 188

Class

MenuLinkManager
Manages discovery, instantiation, and tree building of menu link plugins.

Namespace

Drupal\Core\Menu

Code

public function rebuild() {
    $definitions = $this->getDefinitions();
    // Apply overrides from config.
    $overrides = $this->overrides
        ->loadMultipleOverrides(array_keys($definitions));
    foreach ($overrides as $id => $changes) {
        if (!empty($definitions[$id])) {
            $definitions[$id] = $changes + $definitions[$id];
        }
    }
    $this->treeStorage
        ->rebuild($definitions);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.