function drupal_add_feed

Adds a feed URL for the current page.

This function can be called as long the HTML header hasn't been sent.

Parameters

$url: An internal system path or a fully qualified external URL of the feed.

$title: The title of the feed.

8 calls to drupal_add_feed()
AddFeedTest::testBasicFeedAddNoTitle in drupal/core/modules/system/lib/Drupal/system/Tests/Common/AddFeedTest.php
Tests drupal_add_feed() with paths, URLs, and titles.
aggregator_page_category in drupal/core/modules/aggregator/aggregator.pages.inc
Form constructor to list items aggregated in a category.
aggregator_page_last in drupal/core/modules/aggregator/aggregator.pages.inc
Page callback: Displays the most recent items gathered from any feed.
drupal_get_feeds in drupal/core/includes/common.inc
Gets the feed URLs for the current page.
node_page_default in drupal/core/modules/node/node.module
Page callback: Generates a listing of promoted nodes.

... See full list

File

drupal/core/includes/common.inc, line 375
Common functions that many Drupal modules will need to reference.

Code

function drupal_add_feed($url = NULL, $title = '') {
  $stored_feed_links =& drupal_static(__FUNCTION__, array());
  if (isset($url)) {
    $stored_feed_links[$url] = theme('feed_icon', array(
      'url' => $url,
      'title' => $title,
    ));
    drupal_add_html_head_link(array(
      'rel' => 'alternate',
      'type' => 'application/rss+xml',
      'title' => $title,
      // Force the URL to be absolute, for consistency with other <link> tags
      // output by Drupal.
      'href' => url($url, array(
        'absolute' => TRUE,
      )),
    ));
  }
  return $stored_feed_links;
}