W3cubDocs

/Drupal 8

class 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

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.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Routing!RoutePreloader.php/class/RoutePreloader/8.1.x