public function RouteAccessResponseSubscriber::onRespond in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/EventSubscriber/RouteAccessResponseSubscriber.php \Drupal\Core\EventSubscriber\RouteAccessResponseSubscriber::onRespond()
Bubbles the route's access result' cacheability metadata.
Parameters
\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event: The event to process.
File
- core/
lib/ Drupal/ Core/ EventSubscriber/ RouteAccessResponseSubscriber.php, line 37 - Contains \Drupal\Core\EventSubscriber\RouteAccessResponseSubscriber.
Class
- RouteAccessResponseSubscriber
- Response subscriber to bubble the route's access result's cacheability.
Namespace
Drupal\Core\EventSubscriberCode
public function onRespond(FilterResponseEvent $event) {
if (!$event
->isMasterRequest()) {
return;
}
$response = $event
->getResponse();
if (!$response instanceof CacheableResponseInterface) {
return;
}
$request = $event
->getRequest();
$access_result = $request->attributes
->get(AccessAwareRouterInterface::ACCESS_RESULT);
$response
->addCacheableDependency($access_result);
}