You are here

function views_rss_plugin_style_fields::attach_to in Views RSS 6.2

Same name and namespace in other branches
  1. 7.2 views/views_rss_plugin_style_fields.inc \views_rss_plugin_style_fields::attach_to()

Attach this view to another display as a feed.

File

views/views_rss_plugin_style_fields.inc, line 13
Extends the view_plugin_style class to provide new RSS view style.

Class

views_rss_plugin_style_fields
@file Extends the view_plugin_style class to provide new RSS view style.

Code

function attach_to($display_id, $path, $title) {
  $display = $this->view->display[$display_id]->handler;
  $url_options = array(
    'absolute' => TRUE,
  );
  $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() && !$this->options['feed_settings']['feed_in_links']) {
    if (empty($this->preview)) {
      drupal_add_feed($url, $title);
    }
  }
  else {
    if (empty($this->view->feed_icon)) {
      $this->view->feed_icon = '';
    }
    $this->view->feed_icon .= views_rss_theme7('feed_icon', array(
      'url' => $url,
      'title' => $title,
    ));
    drupal_add_link(array(
      'rel' => 'alternate',
      'type' => 'application/rss+xml',
      'title' => $title,
      'href' => $url,
    ));
  }
}