Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PathRootsSubscriber.php

function PathRootsSubscriber::onRouteAlter

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

public function onRouteAlter(RouteBuildEvent $event) {
    $collection = $event->getRouteCollection();
    foreach ($collection->all() as $route) {
        $bits = explode('/', ltrim($route->getPath(), '/'));
        $this->pathRoots[$bits[0]] = $bits[0];
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal