function BigPipeTestSubscriber::onRespondSetBigPipeDebugPlaceholderHeaders
Same name in other branches
- 8.9.x core/modules/big_pipe/tests/modules/big_pipe_test/src/EventSubscriber/BigPipeTestSubscriber.php \Drupal\big_pipe_test\EventSubscriber\BigPipeTestSubscriber::onRespondSetBigPipeDebugPlaceholderHeaders()
- 10 core/modules/big_pipe/tests/modules/big_pipe_test/src/EventSubscriber/BigPipeTestSubscriber.php \Drupal\big_pipe_test\EventSubscriber\BigPipeTestSubscriber::onRespondSetBigPipeDebugPlaceholderHeaders()
- 11.x core/modules/big_pipe/tests/modules/big_pipe_test/src/EventSubscriber/BigPipeTestSubscriber.php \Drupal\big_pipe_test\EventSubscriber\BigPipeTestSubscriber::onRespondSetBigPipeDebugPlaceholderHeaders()
Exposes all BigPipe placeholders (JS and no-JS) via headers for testing.
Parameters
\Symfony\Component\HttpKernel\Event\ResponseEvent $event: The event to process.
File
-
core/
modules/ big_pipe/ tests/ modules/ big_pipe_test/ src/ EventSubscriber/ BigPipeTestSubscriber.php, line 51
Class
Namespace
Drupal\big_pipe_test\EventSubscriberCode
public function onRespondSetBigPipeDebugPlaceholderHeaders(ResponseEvent $event) {
$response = $event->getResponse();
if (!$response instanceof HtmlResponse) {
return;
}
$attachments = $response->getAttachments();
$response->headers
->set('BigPipe-Test-Placeholders', '<none>');
$response->headers
->set('BigPipe-Test-No-Js-Placeholders', '<none>');
if (!empty($attachments['big_pipe_placeholders'])) {
$response->headers
->set('BigPipe-Test-Placeholders', implode(' ', array_keys($attachments['big_pipe_placeholders'])));
}
if (!empty($attachments['big_pipe_nojs_placeholders'])) {
$response->headers
->set('BigPipe-Test-No-Js-Placeholders', implode(' ', array_map('rawurlencode', array_keys($attachments['big_pipe_nojs_placeholders']))));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.