RoutePreloader

Defines a class which preloads non-admin routes.

On an actual site we want to avoid too many database queries so we build a list of all routes which most likely appear on the actual site, which are all HTML routes not starting with "/admin".

Hierarchy

  • class \Drupal\Core\Routing\RoutePreloader implements EventSubscriberInterface

File

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

Namespace

Drupal\Core\Routing

Members

Name Modifiers Type Description
RoutePreloader::$cache protected property The cache backend used to skip the state loading.
RoutePreloader::$nonAdminRoutesOnRebuild protected property Contains the non-admin routes while rebuilding the routes.
RoutePreloader::$routeProvider protected property The route provider.
RoutePreloader::$state protected property The state key value store.
RoutePreloader::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. Overrides EventSubscriberInterface::getSubscribedEvents
RoutePreloader::onAlterRoutes public function Alters existing routes for a specific collection.
RoutePreloader::onFinishedRoutes public function Store the non admin routes in state when the route building is finished.
RoutePreloader::onRequest public function Loads all non-admin routes right before the actual page is rendered.
RoutePreloader::__construct public function Constructs a new RoutePreloader.
doc_Drupal
2016-10-29 09:39:09
Comments
Leave a Comment

Please login to continue.