Projet

Général

Profil

Révision 5d12d676

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/plugins/views_plugin_display_feed.inc
2 2

  
3 3
/**
4 4
 * @file
5
 * Contains the feed display plugin.
5
 * Definition of views_plugin_display_feed.
6 6
 */
7 7

  
8 8
/**
......
13 13
 * @ingroup views_display_plugins
14 14
 */
15 15
class views_plugin_display_feed extends views_plugin_display_page {
16
  function init(&$view, &$display, $options = NULL) {
16

  
17
  /**
18
   * {@inheritdoc}
19
   */
20
  public function init(&$view, &$display, $options = NULL) {
17 21
    parent::init($view, $display, $options);
18 22

  
19 23
    // Set the default row style. Ideally this would be part of the option
......
26 30
    }
27 31
  }
28 32

  
29
  function uses_breadcrumb() { return FALSE; }
30
  function get_style_type() { return 'feed'; }
33
  /**
34
   * {@inheritdoc}
35
   */
36
  public function uses_breadcrumb() {
37
    return FALSE;
38
  }
39

  
40
  /**
41
   * {@inheritdoc}
42
   */
43
  public function get_style_type() {
44
    return 'feed';
45
  }
31 46

  
32 47
  /**
33 48
   * Feeds do not go through the normal page theming mechanism. Instead, they
34 49
   * go through their own little theme function and then return NULL so that
35 50
   * Drupal believes that the page has already rendered itself...which it has.
36 51
   */
37
  function execute() {
52
  public function execute() {
38 53
    $output = $this->view->render();
39 54
    if (empty($output)) {
40 55
      return MENU_NOT_FOUND;
......
42 57
    print $output;
43 58
  }
44 59

  
45
  function preview() {
60
  /**
61
   * {@inheritdoc}
62
   */
63
  public function preview() {
46 64
    if (!empty($this->view->live_preview)) {
47 65
      return '<pre>' . check_plain($this->view->render()) . '</pre>';
48 66
    }
......
53 71
   * Instead of going through the standard views_view.tpl.php, delegate this
54 72
   * to the style handler.
55 73
   */
56
  function render() {
74
  public function render() {
57 75
    return $this->view->style_plugin->render($this->view->result);
58 76
  }
59 77

  
60
  function defaultable_sections($section = NULL) {
78
  /**
79
   * {@inheritdoc}
80
   */
81
  public function defaultable_sections($section = NULL) {
61 82
    if (in_array($section, array('style_options', 'style_plugin', 'row_options', 'row_plugin',))) {
62 83
      return FALSE;
63 84
    }
......
74 95
    return $sections;
75 96
  }
76 97

  
77
  function option_definition() {
98
  /**
99
   * {@inheritdoc}
100
   */
101
  public function option_definition() {
78 102
    $options = parent::option_definition();
79 103

  
80 104
    $options['displays'] = array('default' => array());
81 105

  
82
    // Overrides for standard stuff:
106
    // Overrides for standard stuff.
83 107
    $options['style_plugin']['default'] = 'rss';
84 108
    $options['style_options']['default']  = array('description' => '');
85 109
    $options['sitename_title']['default'] = FALSE;
......
92 116
    return $options;
93 117
  }
94 118

  
95
  function options_summary(&$categories, &$options) {
96
    // It is very important to call the parent function here:
119
  /**
120
   * {@inheritdoc}
121
   */
122
  public function options_summary(&$categories, &$options) {
123
    // It is very important to call the parent function here.
97 124
    parent::options_summary($categories, $options);
98 125

  
99 126
    // Since we're childing off the 'page' type, we'll still *call* our
......
138 165
  /**
139 166
   * Provide the default form for setting options.
140 167
   */
141
  function options_form(&$form, &$form_state) {
168
  public function options_form(&$form, &$form_state) {
142 169
    // It is very important to call the parent function here.
143 170
    parent::options_form($form, $form_state);
144 171

  
......
155 182
        $form['title'] = $title;
156 183
        $form['title']['#dependency'] = array('edit-sitename-title' => array(FALSE));
157 184
        break;
185

  
158 186
      case 'displays':
159 187
        $form['#title'] .= t('Attach to');
160 188
        $displays = array();
......
170 198
          '#default_value' => $this->get_option('displays'),
171 199
        );
172 200
        break;
201

  
173 202
      case 'path':
174 203
        $form['path']['#description'] = t('This view will be displayed by visiting this path on your site. It is recommended that the path be something like "path/%/%/feed" or "path/%/%/rss.xml", putting one % in the path for each contextual filter you have defined in the view.');
204
        break;
175 205
    }
176 206
  }
177 207

  
......
179 209
   * Perform any necessary changes to the form values prior to storage.
180 210
   * There is no need for this function to actually store the data.
181 211
   */
182
  function options_submit(&$form, &$form_state) {
183
    // It is very important to call the parent function here:
212
  public function options_submit(&$form, &$form_state) {
213
    // It is very important to call the parent function here.
184 214
    parent::options_submit($form, $form_state);
185 215
    switch ($form_state['section']) {
186 216
      case 'title':
187 217
        $this->set_option('sitename_title', $form_state['values']['sitename_title']);
188 218
        break;
219

  
189 220
      case 'displays':
190 221
        $this->set_option($form_state['section'], $form_state['values'][$form_state['section']]);
191 222
        break;
......
195 226
  /**
196 227
   * Attach to another view.
197 228
   */
198
  function attach_to($display_id) {
229
  public function attach_to($display_id) {
199 230
    $displays = $this->get_option('displays');
200 231
    if (empty($displays[$display_id])) {
201 232
      return;
......
216 247
    }
217 248
  }
218 249

  
219
  function uses_link_display() {
250
  /**
251
   * {@inheritdoc}
252
   */
253
  public function uses_link_display() {
220 254
    return TRUE;
221 255
  }
256

  
222 257
}

Formats disponibles : Unified diff