You are here

public function HtmlResponseSubscriber::onRespond in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/EventSubscriber/HtmlResponseSubscriber.php \Drupal\Core\EventSubscriber\HtmlResponseSubscriber::onRespond()

Processes attachments for HtmlResponse responses.

Parameters

\Symfony\Component\HttpKernel\Event\ResponseEvent $event: The event to process.

File

core/lib/Drupal/Core/EventSubscriber/HtmlResponseSubscriber.php, line 39

Class

HtmlResponseSubscriber
Response subscriber to handle HTML responses.

Namespace

Drupal\Core\EventSubscriber

Code

public function onRespond(ResponseEvent $event) {
  $response = $event
    ->getResponse();
  if (!$response instanceof HtmlResponse) {
    return;
  }
  $event
    ->setResponse($this->htmlResponseAttachmentsProcessor
    ->processAttachments($response));
}