public function RoutePreloader::onAlterRoutes in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Routing/RoutePreloader.php \Drupal\Core\Routing\RoutePreloader::onAlterRoutes()
Alters existing routes for a specific collection.
Parameters
\Drupal\Core\Routing\RouteBuildEvent $event: The route build event.
File
- core/
lib/ Drupal/ Core/ Routing/ RoutePreloader.php, line 104 - Contains \Drupal\Core\Routing\RoutePreloader.
Class
- RoutePreloader
- Defines a class which preloads non-admin routes.
Namespace
Drupal\Core\RoutingCode
public function onAlterRoutes(RouteBuildEvent $event) {
$collection = $event
->getRouteCollection();
foreach ($collection
->all() as $name => $route) {
if (strpos($route
->getPath(), '/admin/') !== 0 && $route
->getPath() != '/admin') {
$this->nonAdminRoutesOnRebuild[] = $name;
}
}
$this->nonAdminRoutesOnRebuild = array_unique($this->nonAdminRoutesOnRebuild);
}