public function LayoutBuilderRoutes::onAlterRoutes in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/Routing/LayoutBuilderRoutes.php \Drupal\layout_builder\Routing\LayoutBuilderRoutes::onAlterRoutes()
- 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\RoutingCode
public function onAlterRoutes(RouteBuildEvent $event) {
$collection = $event
->getRouteCollection();
foreach ($this->sectionStorageManager
->getDefinitions() as $plugin_id => $definition) {
$this->sectionStorageManager
->loadEmpty($plugin_id)
->buildRoutes($collection);
}
}