public function BigPipeTestSubscriber::onRespondTriggerException in Drupal 8
Same name and namespace in other branches
- 9 core/modules/big_pipe/tests/modules/big_pipe_test/src/EventSubscriber/BigPipeTestSubscriber.php \Drupal\big_pipe_test\EventSubscriber\BigPipeTestSubscriber::onRespondTriggerException()
Triggers exception for embedded HTML/AJAX responses with certain content.
Parameters
\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event: The event to process.
Throws
\Exception
See also
\Drupal\big_pipe_test\BigPipeTestController::responseException()
File
- core/
modules/ big_pipe/ tests/ modules/ big_pipe_test/ src/ EventSubscriber/ BigPipeTestSubscriber.php, line 30
Class
Namespace
Drupal\big_pipe_test\EventSubscriberCode
public function onRespondTriggerException(FilterResponseEvent $event) {
$response = $event
->getResponse();
if (!$response instanceof AttachmentsInterface) {
return;
}
$attachments = $response
->getAttachments();
if (!isset($attachments['big_pipe_placeholders']) && !isset($attachments['big_pipe_nojs_placeholders'])) {
if (strpos($response
->getContent(), static::CONTENT_TRIGGER_EXCEPTION) !== FALSE) {
throw new \Exception('Oh noes!');
}
}
}