2
// $Id: views_plugin_style_rss.inc,v 1.2 2008/12/02 00:02:06 merlinofchaos Exp $
5
* Contains the RSS style plugin.
9
* Default style plugin to render an RSS feed.
11
* @ingroup views_style_plugins
13
class views_plugin_style_rss extends views_plugin_style {
14
function attach_to($display_id, $path, $title) {
15
$display = $this->view->display[$display_id]->handler;
16
$url_options = array();
17
$input = $this->view->get_exposed_input();
19
$url_options['query'] = $input;
22
$url = url($this->view->get_url(NULL, $path), $url_options);
23
if ($display->has_path()) {
24
if (empty($this->preview)) {
25
drupal_add_feed($url, $title);
29
if (empty($this->view->feed_icon)) {
30
$this->view->feed_icon = '';
33
$this->view->feed_icon .= theme('feed_icon', $url, $title);
34
drupal_add_link(array(
36
'type' => 'application/rss+xml',
43
function option_definition() {
44
$options = parent::option_definition();
46
$options['description'] = array('default' => '', 'translatable' => TRUE);
47
$options['mission_description'] = array('default' => '', 'translatable' => TRUE);
52
function options_form(&$form, &$form_state) {
53
$form['mission_description'] = array(
54
'#type' => 'checkbox',
55
'#default_value' => !empty($this->options['mission_description']),
56
'#title' => t('Use the site mission for the description'),
58
$form['description'] = array(
59
'#type' => 'textfield',
60
'#title' => t('RSS description'),
61
'#default_value' => $this->options['description'],
62
'#description' => t('This will appear in the RSS feed itself.'),
63
'#process' => array('views_process_dependency'),
64
'#dependency' => array('edit-style-options-override' => array(FALSE)),
69
* Return an array of additional XHTML elements to add to the channel.
72
* An array that can be passed to format_xml_elements().
74
function get_channel_elements() {
79
if (empty($this->row_plugin)) {
80
vpr('views_plugin_style_default: Missing row plugin');
85
// This will be filled in by the row plugin and is used later on in the
87
$this->namespaces = array();
89
// Fetch any additional elements for the channel and merge in their
91
$this->channel_elements = $this->get_channel_elements();
92
foreach ($this->channel_elements as $element) {
93
if (isset($element['namespace'])) {
94
$this->namespaces = array_merge($this->namespaces, $element['namespace']);
98
foreach ($this->view->result as $row) {
99
$rows .= $this->row_plugin->render($row);
102
return theme($this->theme_functions(), $this->view, $this->options, $rows);