You are here

public function LayoutBuilderRoutes::onAlterRoutes in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Routing/LayoutBuilderRoutes.php \Drupal\layout_builder\Routing\LayoutBuilderRoutes::onAlterRoutes()

Alters existing routes for a specific collection.

Parameters

\Drupal\Core\Routing\RouteBuildEvent $event: The route build event.

File

core/modules/layout_builder/src/Routing/LayoutBuilderRoutes.php, line 41

Class

LayoutBuilderRoutes
Provides routes for the Layout Builder UI.

Namespace

Drupal\layout_builder\Routing

Code

public function onAlterRoutes(RouteBuildEvent $event) {
  $collection = $event
    ->getRouteCollection();
  foreach ($this->sectionStorageManager
    ->getDefinitions() as $plugin_id => $definition) {
    $this->sectionStorageManager
      ->loadEmpty($plugin_id)
      ->buildRoutes($collection);
  }
}