You are here

public static function RoutePreloader::getSubscribedEvents in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Routing/RoutePreloader.php \Drupal\Core\Routing\RoutePreloader::getSubscribedEvents()

File

core/lib/Drupal/Core/Routing/RoutePreloader.php, line 120

Class

RoutePreloader
Defines a class which preloads non-admin routes.

Namespace

Drupal\Core\Routing

Code

public static function getSubscribedEvents() {

  // Set a really low priority to catch as many as possible routes.
  $events[RoutingEvents::ALTER] = [
    'onAlterRoutes',
    -1024,
  ];
  $events[RoutingEvents::FINISHED] = [
    'onFinishedRoutes',
  ];

  // Load the routes before the controller is executed (which happens after
  // the kernel request event).
  $events[KernelEvents::REQUEST][] = [
    'onRequest',
  ];
  return $events;
}