Change record status: 
Project: 
Introduced in branch: 
8.0.x
Description: 

drupal_add_feed/drupal_add_html_head/drupal_get_html_head/drupal_get_feeds
got replaced by value objects on the html page object. This means that adding those elements should be either
done via drupal_add_feed in the render array of via a kernel view subscriber.

Example of using a direct call to drupal_add_feed and replace it with a kernel view subscriber:

D7

function some_function() {
  drupal_add_feed('Title', 'example-path');
}

D8


use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Drupal\Core\Page\FeedLinkTag

class ExampleViewSubscriber implements EventSubscriberInterface {

  public function onHtmlPage(GetResponseForControllerResultEvent $event) {
    if (($page = $event->getControllerResult()) && $page instanceof HtmlPage) {
      $feed = new FeedLinkTag('title', 'example-path');
      $page = $event->addLink($feed);
    }
  }

  public function getSubscribers() {
    $events[KernelEvents::VIEW][] = array('onHtmlPage', 60);
  }
}
Impacts: 
Module developers

Comments

dave reid’s picture

This appears to have been massively changed in 8.0.x. I think https://www.drupal.org/node/2160069 is the valid change record now still and this should probably be deleted.