function HtmlResponsePlaceholderStrategySubscriber::onRespond
Same name in other branches
- 9 core/lib/Drupal/Core/EventSubscriber/HtmlResponsePlaceholderStrategySubscriber.php \Drupal\Core\EventSubscriber\HtmlResponsePlaceholderStrategySubscriber::onRespond()
- 8.9.x core/lib/Drupal/Core/EventSubscriber/HtmlResponsePlaceholderStrategySubscriber.php \Drupal\Core\EventSubscriber\HtmlResponsePlaceholderStrategySubscriber::onRespond()
- 10 core/lib/Drupal/Core/EventSubscriber/HtmlResponsePlaceholderStrategySubscriber.php \Drupal\Core\EventSubscriber\HtmlResponsePlaceholderStrategySubscriber::onRespond()
Processes placeholders for HTML responses.
Parameters
\Symfony\Component\HttpKernel\Event\ResponseEvent $event: The event to process.
File
-
core/
lib/ Drupal/ Core/ EventSubscriber/ HtmlResponsePlaceholderStrategySubscriber.php, line 45
Class
- HtmlResponsePlaceholderStrategySubscriber
- HTML response subscriber to allow for different placeholder strategies.
Namespace
Drupal\Core\EventSubscriberCode
public function onRespond(ResponseEvent $event) {
$response = $event->getResponse();
if (!$response instanceof HtmlResponse) {
return;
}
$attachments = $response->getAttachments();
if (empty($attachments['placeholders'])) {
return;
}
$attachments['placeholders'] = $this->placeholderStrategy
->processPlaceholders($attachments['placeholders']);
$response->setAttachments($attachments);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.