protected function WebprofilerEventSubscriber::injectToolbar in Devel 8.3
Same name and namespace in other branches
- 8 webprofiler/src/EventSubscriber/WebprofilerEventSubscriber.php \Drupal\webprofiler\EventSubscriber\WebprofilerEventSubscriber::injectToolbar()
- 8.2 webprofiler/src/EventSubscriber/WebprofilerEventSubscriber.php \Drupal\webprofiler\EventSubscriber\WebprofilerEventSubscriber::injectToolbar()
- 4.x webprofiler/src/EventSubscriber/WebprofilerEventSubscriber.php \Drupal\webprofiler\EventSubscriber\WebprofilerEventSubscriber::injectToolbar()
Parameters
\Symfony\Component\HttpFoundation\Response $response:
1 call to WebprofilerEventSubscriber::injectToolbar()
- WebprofilerEventSubscriber::onKernelResponse in webprofiler/
src/ EventSubscriber/ WebprofilerEventSubscriber.php
File
- webprofiler/
src/ EventSubscriber/ WebprofilerEventSubscriber.php, line 71
Class
- WebprofilerEventSubscriber
- Class WebprofilerEventSubscriber.
Namespace
Drupal\webprofiler\EventSubscriberCode
protected function injectToolbar(Response $response) {
$content = $response
->getContent();
$pos = mb_strripos($content, '</body>');
if (FALSE !== $pos) {
if ($token = $response->headers
->get('X-Debug-Token')) {
$loader = [
'#theme' => 'webprofiler_loader',
'#token' => $token,
'#profiler_url' => $this->urlGenerator
->generate('webprofiler.toolbar', [
'profile' => $token,
]),
];
$content = mb_substr($content, 0, $pos) . $this->renderer
->renderRoot($loader) . mb_substr($content, $pos);
$response
->setContent($content);
}
}
}