function HtmlResponseSubscriber::onRespond

Same name in other branches
  1. 9 core/lib/Drupal/Core/EventSubscriber/HtmlResponseSubscriber.php \Drupal\Core\EventSubscriber\HtmlResponseSubscriber::onRespond()
  2. 8.9.x core/lib/Drupal/Core/EventSubscriber/HtmlResponseSubscriber.php \Drupal\Core\EventSubscriber\HtmlResponseSubscriber::onRespond()
  3. 11.x 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));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.