1 common.inc backdrop_add_feed($url = NULL, $title = '')

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.

File

core/includes/common.inc, line 445
Common functions that many Backdrop modules will need to reference.

Code

function backdrop_add_feed($url = NULL, $title = '') {
  $stored_feed_links = &backdrop_static(__FUNCTION__, array());

  if (isset($url)) {
    $stored_feed_links[$url] = theme('feed_icon', array('url' => $url, 'title' => $title));

    backdrop_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 Backdrop.
      'href' => url($url, array('absolute' => TRUE)),
    ));
  }
  return $stored_feed_links;
}