Drupal 8  8.0.2
RoutePreloader Class Reference
Inheritance diagram for RoutePreloader:

Public Member Functions

 __construct (RouteProviderInterface $route_provider, StateInterface $state, CacheBackendInterface $cache)
 
 onRequest (KernelEvent $event)
 
 onAlterRoutes (RouteBuildEvent $event)
 
 onFinishedRoutes (Event $event)
 

Static Public Member Functions

static getSubscribedEvents ()
 

Protected Attributes

 $routeProvider
 
 $state
 
 $nonAdminRoutesOnRebuild = array()
 
 $cache
 

Detailed Description

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".

Constructor & Destructor Documentation

__construct ( RouteProviderInterface  $route_provider,
StateInterface  $state,
CacheBackendInterface  $cache 
)

Constructs a new RoutePreloader.

Parameters
\Drupal\Core\Routing\RouteProviderInterface$route_providerThe route provider.
\Drupal\Core\State\StateInterface$stateThe state key value store.
\Drupal\Core\Cache\CacheBackendInterface$cache

References Drupal\cache(), and Drupal\state().

Here is the call graph for this function:

Member Function Documentation

static getSubscribedEvents ( )
static

{}

onAlterRoutes ( RouteBuildEvent  $event)

Alters existing routes for a specific collection.

Parameters
\Drupal\Core\Routing\RouteBuildEvent$eventThe route build event.

References RouteBuildEvent\getRouteCollection().

Here is the call graph for this function:

onFinishedRoutes ( Event  $event)

Store the non admin routes in state when the route building is finished.

Parameters
\Symfony\Component\EventDispatcher\Event$eventThe route finish event.

References Drupal\state().

Here is the call graph for this function:

onRequest ( KernelEvent  $event)

Loads all non-admin routes right before the actual page is rendered.

Parameters
\Symfony\Component\HttpKernel\Event\KernelEvent$eventThe event to process.

References Drupal\cache(), Cache\PERMANENT, and Drupal\state().

Here is the call graph for this function:


The documentation for this class was generated from the following file: