class RouterRebuildSubscriber in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/EventSubscriber/RouterRebuildSubscriber.php \Drupal\Core\EventSubscriber\RouterRebuildSubscriber
Rebuilds the router if needed at the end of the request.
Hierarchy
- class \Drupal\Core\EventSubscriber\RouterRebuildSubscriber implements EventSubscriberInterface
Expanded class hierarchy of RouterRebuildSubscriber
File
- core/
lib/ Drupal/ Core/ EventSubscriber/ RouterRebuildSubscriber.php, line 18 - Contains \Drupal\Core\EventSubscriber\RouterRebuildSubscriber.
Namespace
Drupal\Core\EventSubscriberView source
class RouterRebuildSubscriber implements EventSubscriberInterface {
/**
* @var \Drupal\Core\Routing\RouteBuilderInterface
*/
protected $routeBuilder;
/**
* Constructs the RouterRebuildSubscriber object.
*
* @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder
* The route builder.
*/
public function __construct(RouteBuilderInterface $route_builder) {
$this->routeBuilder = $route_builder;
}
/**
* Rebuilds routers if necessary.
*
* @param \Symfony\Component\HttpKernel\Event\PostResponseEvent $event
* The event object.
*/
public function onKernelTerminate(PostResponseEvent $event) {
$this->routeBuilder
->rebuildIfNeeded();
}
/**
* {@inheritdoc}
*/
static function getSubscribedEvents() {
$events[KernelEvents::TERMINATE][] = array(
'onKernelTerminate',
200,
);
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouterRebuildSubscriber:: |
protected | property | ||
RouterRebuildSubscriber:: |
static | function |
Returns an array of event names this subscriber wants to listen to. Overrides EventSubscriberInterface:: |
|
RouterRebuildSubscriber:: |
public | function | Rebuilds routers if necessary. | |
RouterRebuildSubscriber:: |
public | function | Constructs the RouterRebuildSubscriber object. |