public function WebprofilerEventSubscriber::onKernelResponse in Devel 4.x
Same name and namespace in other branches
- 8.3 webprofiler/src/EventSubscriber/WebprofilerEventSubscriber.php \Drupal\webprofiler\EventSubscriber\WebprofilerEventSubscriber::onKernelResponse()
- 8 webprofiler/src/EventSubscriber/WebprofilerEventSubscriber.php \Drupal\webprofiler\EventSubscriber\WebprofilerEventSubscriber::onKernelResponse()
- 8.2 webprofiler/src/EventSubscriber/WebprofilerEventSubscriber.php \Drupal\webprofiler\EventSubscriber\WebprofilerEventSubscriber::onKernelResponse()
Parameters
\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event:
File
- webprofiler/
src/ EventSubscriber/ WebprofilerEventSubscriber.php, line 47
Class
- WebprofilerEventSubscriber
- Class WebprofilerEventSubscriber.
Namespace
Drupal\webprofiler\EventSubscriberCode
public function onKernelResponse(FilterResponseEvent $event) {
$response = $event
->getResponse();
$request = $event
->getRequest();
if ($response->headers
->has('X-Debug-Token') && NULL !== $this->urlGenerator) {
$response->headers
->set('X-Debug-Token-Link', $this->urlGenerator
->generate('webprofiler.dashboard', [
'profile' => $response->headers
->get('X-Debug-Token'),
]));
}
// Do not capture redirects or modify XML HTTP Requests.
if ($request
->isXmlHttpRequest()) {
return;
}
if ($this->currentUser
->hasPermission('view webprofiler toolbar')) {
$this
->injectToolbar($response);
}
}