public function MockedDynamicPageCacheSubscriber::onRouteMatch in Permissions by Term 8
Same name and namespace in other branches
- 8.2 modules/permissions_by_entity/tests/modules/pbt_entity_test/src/EventSubscriber/MockedDynamicPageCacheSubscriber.php \Drupal\pbt_entity_test\EventSubscriber\MockedDynamicPageCacheSubscriber::onRouteMatch()
File
- modules/
permissions_by_entity/ tests/ modules/ pbt_entity_test/ src/ EventSubscriber/ MockedDynamicPageCacheSubscriber.php, line 19
Class
- MockedDynamicPageCacheSubscriber
- Mocked dynamic page cache subscriber.
Namespace
Drupal\pbt_entity_test\EventSubscriberCode
public function onRouteMatch(GetResponseEvent $event) {
// Sets the response for the current route, if cached.
$cached = $this->renderCache
->get($this->dynamicPageCacheRedirectRenderArray);
if ($cached) {
$response = $this
->renderArrayToResponse($cached);
$response->headers
->set(self::HEADER, 'HIT');
$event
->setResponse($response);
}
}