| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @file 4 * Contains the RSS style plugin. 5 */ 6 7 /** 8 * Default style plugin to render an RSS feed. 9 * 10 * @ingroup views_style_plugins 11 */ 12 class views_plugin_style_rss extends views_plugin_style { 13 function attach_to($display_id, $path, $title) { 14 $display = $this->view->display[$display_id]->handler; 15 $url_options = array(); 16 $input = $this->view->get_exposed_input(); 17 if ($input) { 18 $url_options['query'] = $input; 19 } 20 21 $url = url($this->view->get_url(NULL, $path), $url_options); 22 if ($display->has_path()) { 23 if (empty($this->preview)) { 24 drupal_add_feed($url, $title); 25 } 26 } 27 else { 28 if (empty($this->view->feed_icon)) { 29 $this->view->feed_icon = ''; 30 } 31 32 $this->view->feed_icon .= theme('feed_icon', $url, $title); 33 drupal_add_link(array( 34 'rel' => 'alternate', 35 'type' => 'application/rss+xml', 36 'title' => $title, 37 'href' => $url 38 )); 39 } 40 } 41 42 function option_definition() { 43 $options = parent::option_definition(); 44 45 $options['description'] = array('default' => '', 'translatable' => TRUE); 46 $options['mission_description'] = array('default' => '', 'translatable' => TRUE); 47 48 return $options; 49 } 50 51 function options_form(&$form, &$form_state) { 52 parent::options_form($form, $form_state); 53 54 $form['mission_description'] = array( 55 '#type' => 'checkbox', 56 '#default_value' => !empty($this->options['mission_description']), 57 '#title' => t('Use the site mission for the description'), 58 ); 59 $form['description'] = array( 60 '#type' => 'textfield', 61 '#title' => t('RSS description'), 62 '#default_value' => $this->options['description'], 63 '#description' => t('This will appear in the RSS feed itself.'), 64 '#process' => array('views_process_dependency'), 65 '#dependency' => array('edit-style-options-override' => array(FALSE)), 66 ); 67 } 68 69 /** 70 * Return an array of additional XHTML elements to add to the channel. 71 * 72 * @return 73 * An array that can be passed to format_xml_elements(). 74 */ 75 function get_channel_elements() { 76 return array(); 77 } 78 79 function render() { 80 if (empty($this->row_plugin)) { 81 vpr('views_plugin_style_default: Missing row plugin'); 82 return; 83 } 84 $rows = ''; 85 86 // This will be filled in by the row plugin and is used later on in the 87 // theming output. 88 $this->namespaces = array(); 89 90 // Fetch any additional elements for the channel and merge in their 91 // namespaces. 92 $this->channel_elements = $this->get_channel_elements(); 93 foreach ($this->channel_elements as $element) { 94 if (isset($element['namespace'])) { 95 $this->namespaces = array_merge($this->namespaces, $element['namespace']); 96 } 97 } 98 99 foreach ($this->view->result as $row_index => $row) { 100 $this->view->row_index = $row_index; 101 $rows .= $this->row_plugin->render($row); 102 } 103 104 $output = theme($this->theme_functions(), $this->view, $this->options, $rows); 105 unset($this->view->row_index); 106 107 return $output; 108 } 109 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |