public function AmpHtmlResponseSubscriber::onRespond in Accelerated Mobile Pages (AMP) 8
Same name and namespace in other branches
- 8.2 src/EventSubscriber/AmpHtmlResponseSubscriber.php \Drupal\amp\EventSubscriber\AmpHtmlResponseSubscriber::onRespond()
Processes markup for HtmlResponse responses.
Parameters
\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event: The event to process.
File
- src/
EventSubscriber/ AmpHtmlResponseSubscriber.php, line 53 - Contains \Drupal\amp\EventSubscriber\AmpHtmlResponseSubscriber.
Class
- AmpHtmlResponseSubscriber
- Response subscriber to handle amp HTML responses.
Namespace
Drupal\amp\EventSubscriberCode
public function onRespond(FilterResponseEvent $event) {
$response = $event
->getResponse();
if (!$response instanceof HtmlResponse) {
return;
}
if ($this->ampContext
->isAmpRoute()) {
$event
->setResponse($this->ampHtmlResponseMarkupProcessor
->processMarkupToAmp($response));
}
}