function RssResponseRelativeUrlFilter::onResponse
Same name in other branches
- 9 core/lib/Drupal/Core/EventSubscriber/RssResponseRelativeUrlFilter.php \Drupal\Core\EventSubscriber\RssResponseRelativeUrlFilter::onResponse()
- 10 core/lib/Drupal/Core/EventSubscriber/RssResponseRelativeUrlFilter.php \Drupal\Core\EventSubscriber\RssResponseRelativeUrlFilter::onResponse()
- 11.x core/lib/Drupal/Core/EventSubscriber/RssResponseRelativeUrlFilter.php \Drupal\Core\EventSubscriber\RssResponseRelativeUrlFilter::onResponse()
Converts relative URLs to absolute URLs.
Parameters
\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event: The response event.
File
-
core/
lib/ Drupal/ Core/ EventSubscriber/ RssResponseRelativeUrlFilter.php, line 22
Class
- RssResponseRelativeUrlFilter
- Subscribes to filter RSS responses, to make relative URIs absolute.
Namespace
Drupal\Core\EventSubscriberCode
public function onResponse(FilterResponseEvent $event) {
// Only care about RSS responses.
if (stripos($event->getResponse()->headers
->get('Content-Type'), 'application/rss+xml') === FALSE) {
return;
}
$response = $event->getResponse();
$response->setContent($this->transformRootRelativeUrlsToAbsolute($response->getContent(), $event->getRequest()));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.