function Rss::attach_to

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php, line 35
Definition of Drupal\views\Plugin\views\style\Rss.

Class

Rss
Default style plugin to render an RSS feed.

Namespace

Drupal\views\Plugin\views\style

Code

function attach_to($display_id, $path, $title) {
  $display = $this->view->displayHandlers[$display_id];
  $url_options = array();
  $input = $this->view
    ->getExposedInput();
  if ($input) {
    $url_options['query'] = $input;
  }
  $url_options['absolute'] = TRUE;
  $url = url($this->view
    ->getUrl(NULL, $path), $url_options);
  if ($display
    ->hasPath()) {
    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', array(
      'url' => $url,
      'title' => $title,
    ));
    drupal_add_html_head_link(array(
      'rel' => 'alternate',
      'type' => 'application/rss+xml',
      'title' => $title,
      'href' => $url,
    ));
  }
}