public PathRootsSubscriber::onRouteAlter(RouteBuildEvent $event)
Collects all path roots.
Parameters
\Drupal\Core\Routing\RouteBuildEvent $event: The route build event.
File
- core/lib/Drupal/Core/EventSubscriber/PathRootsSubscriber.php, line 48
Class
- PathRootsSubscriber
- Provides all available first bits of all route paths.
Namespace
Drupal\Core\EventSubscriber
Code
1 2 3 4 5 6 7 | public function onRouteAlter(RouteBuildEvent $event ) { $collection = $event ->getRouteCollection(); foreach ( $collection ->all() as $route ) { $bits = explode ( '/' , ltrim( $route ->getPath(), '/' )); $this ->pathRoots[ $bits [0]] = $bits [0]; } } |
Please login to continue.