You are here

function views_plugin_style_rss::attach_to in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 plugins/views_plugin_style_rss.inc \views_plugin_style_rss::attach_to()
  2. 7.3 plugins/views_plugin_style_rss.inc \views_plugin_style_rss::attach_to()

File

plugins/views_plugin_style_rss.inc, line 13
Contains the RSS style plugin.

Class

views_plugin_style_rss
Default style plugin to render an RSS feed.

Code

function attach_to($display_id, $path, $title) {
  $display = $this->view->display[$display_id]->handler;
  $url_options = array();
  $input = $this->view
    ->get_exposed_input();
  if ($input) {
    $url_options['query'] = $input;
  }
  $url = url($this->view
    ->get_url(NULL, $path), $url_options);
  if ($display
    ->has_path()) {
    if (empty($this->preview)) {
      drupal_add_feed($url, $title);
    }
  }
  else {
    if (empty($this->view->feed_icon)) {
      $this->view->feed_icon = '';
    }
    $this->view->feed_icon .= theme('feed_icon', $url, $title);
    drupal_add_link(array(
      'rel' => 'alternate',
      'type' => 'application/rss+xml',
      'title' => $title,
      'href' => $url,
    ));
  }
}