Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. RssResponseCdata.php

function RssResponseCdata::onResponse

Wraps RSS descriptions in CDATA.

Parameters

\Symfony\Component\HttpKernel\Event\ResponseEvent $event: The response event.

File

core/lib/Drupal/Core/EventSubscriber/RssResponseCdata.php, line 21

Class

RssResponseCdata
Subscribes to wrap RSS descriptions in CDATA.

Namespace

Drupal\Core\EventSubscriber

Code

public function onResponse(ResponseEvent $event) : void {
    // Skip responses that are not RSS.
    if (stripos($event->getResponse()->headers
        ->get('Content-Type', ''), 'application/rss+xml') === FALSE) {
        return;
    }
    $response = $event->getResponse();
    $response->setContent($this->wrapDescriptionCdata($response->getContent()));
}
RSS feed
Powered by Drupal