function NavigationSectionStorage::buildRoutes

Same name in other branches
  1. 11.x core/modules/navigation/src/Plugin/SectionStorage/NavigationSectionStorage.php \Drupal\navigation\Plugin\SectionStorage\NavigationSectionStorage::buildRoutes()

Overrides SectionStorageInterface::buildRoutes

File

core/modules/navigation/src/Plugin/SectionStorage/NavigationSectionStorage.php, line 147

Class

NavigationSectionStorage
Provides navigation section storage.

Namespace

Drupal\navigation\Plugin\SectionStorage

Code

public function buildRoutes(RouteCollection $collection) : void {
    $this->buildLayoutRoutes($collection, $this->getPluginDefinition(), '/admin/config/user-interface/navigation-block');
    $default_route = 'layout_builder.' . $this->getPluginDefinition()
        ->id() . '.view';
    $route = $collection->get($default_route);
    // Use a form for editing the layout instead of a controller.
    $defaults = $route->getDefaults();
    $defaults['_form'] = LayoutForm::class;
    unset($defaults['_controller']);
    $route->setDefaults($defaults);
}

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