function views_plugin_style_rss_fields::attach_to in Views RSS 6
Same name and namespace in other branches
- 7 views/views_plugin_style_rss_fields.inc \views_plugin_style_rss_fields::attach_to()
Attach this view to another display as a feed.
Provide basic functionality for all export style views like attaching a feed image link.
File
- views/
views_plugin_style_rss_fields.inc, line 13
Class
- views_plugin_style_rss_fields
- Extend the view_plugin_style class to provide an RSS view style.
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() && !$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 .= theme('feed_icon', $url, $title);
drupal_add_link(array(
'rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => $title,
'href' => $url,
));
}
}