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_attachment.inc
2 2

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

  
8 8
/**
......
15 15
 * @ingroup views_display_plugins
16 16
 */
17 17
class views_plugin_display_attachment extends views_plugin_display {
18
  function option_definition () {
18

  
19
  /**
20
   * {@inheritdoc}
21
   */
22
  public function option_definition () {
19 23
    $options = parent::option_definition();
20 24

  
21 25
    $options['displays'] = array('default' => array());
......
28 32
    return $options;
29 33
  }
30 34

  
31
  function execute() {
35
  /**
36
   * {@inheritdoc}
37
   */
38
  public function execute() {
32 39
    return $this->view->render($this->display->id);
33 40
  }
34 41

  
35
  function attachment_positions($position = NULL) {
42
  /**
43
   * {@inheritdoc}
44
   */
45
  public function attachment_positions($position = NULL) {
36 46
    $positions = array(
37 47
      'before' => t('Before'),
38 48
      'after' => t('After'),
......
51 61
   *
52 62
   * This output is returned as an array.
53 63
   */
54
  function options_summary(&$categories, &$options) {
55
    // It is very important to call the parent function here:
64
  public function options_summary(&$categories, &$options) {
65
    // It is very important to call the parent function here.
56 66
    parent::options_summary($categories, $options);
57 67

  
58 68
    $categories['attachment'] = array(
......
119 129
  /**
120 130
   * Provide the default form for setting options.
121 131
   */
122
  function options_form(&$form, &$form_state) {
123
    // It is very important to call the parent function here:
132
  public function options_form(&$form, &$form_state) {
133
    // It is very important to call the parent function here.
124 134
    parent::options_form($form, $form_state);
125 135

  
126 136
    switch ($form_state['section']) {
......
133 143
          '#default_value' => $this->get_option('inherit_arguments'),
134 144
        );
135 145
        break;
146

  
136 147
      case 'inherit_exposed_filters':
137 148
        $form['#title'] .= t('Inherit exposed filters');
138 149
        $form['inherit_exposed_filters'] = array(
......
142 153
          '#default_value' => $this->get_option('inherit_exposed_filters'),
143 154
        );
144 155
        break;
156

  
145 157
      case 'inherit_pager':
146 158
        $form['#title'] .= t('Inherit pager');
147 159
        $form['inherit_pager'] = array(
......
151 163
          '#default_value' => $this->get_option('inherit_pager'),
152 164
        );
153 165
        break;
166

  
154 167
      case 'render_pager':
155 168
        $form['#title'] .= t('Render pager');
156 169
        $form['render_pager'] = array(
......
160 173
          '#default_value' => $this->get_option('render_pager'),
161 174
        );
162 175
        break;
176

  
163 177
      case 'attachment_position':
164 178
        $form['#title'] .= t('Position');
165 179
        $form['attachment_position'] = array(
......
169 183
          '#default_value' => $this->get_option('attachment_position'),
170 184
        );
171 185
        break;
186

  
172 187
      case 'displays':
173 188
        $form['#title'] .= t('Attach to');
174 189
        $displays = array();
......
191 206
   * Perform any necessary changes to the form values prior to storage.
192 207
   * There is no need for this function to actually store the data.
193 208
   */
194
  function options_submit(&$form, &$form_state) {
195
    // It is very important to call the parent function here:
209
  public function options_submit(&$form, &$form_state) {
210
    // It is very important to call the parent function here.
196 211
    parent::options_submit($form, $form_state);
197 212
    switch ($form_state['section']) {
198 213
      case 'inherit_arguments':
......
209 224
  /**
210 225
   * Attach to another view.
211 226
   */
212
  function attach_to($display_id) {
227
  public function attach_to($display_id) {
213 228
    $displays = $this->get_option('displays');
214 229

  
215 230
    if (empty($displays[$display_id])) {
......
220 235
      return;
221 236
    }
222 237

  
223
    // Get a fresh view because our current one has a lot of stuff on it because it's
224
    // already been executed.
238
    // Get a fresh view because our current one has a lot of stuff on it
239
    // because it's already been executed.
225 240
    $view = $this->view->clone_view();
226 241
    $view->original_args = $view->args;
227 242

  
......
241 256
      case 'before':
242 257
        $this->view->attachment_before .= $attachment;
243 258
        break;
259

  
244 260
      case 'after':
245 261
        $this->view->attachment_after .= $attachment;
246 262
        break;
263

  
247 264
      case 'both':
248 265
        $this->view->attachment_before .= $attachment;
249 266
        $this->view->attachment_after .= $attachment;
......
254 271
  }
255 272

  
256 273
  /**
257
   * Attachment displays only use exposed widgets if
258
   * they are set to inherit the exposed filter settings
259
   * of their parent display.
274
   * Attachment displays only use exposed widgets if they are set to inherit
275
   * the exposed filter settings of their parent display.
260 276
   */
261
  function uses_exposed() {
277
  public function uses_exposed() {
262 278
    if (!empty($this->options['inherit_exposed_filters']) && parent::uses_exposed()) {
263 279
      return TRUE;
264 280
    }
......
266 282
  }
267 283

  
268 284
  /**
269
   * If an attachment is set to inherit the exposed filter
270
   * settings from its parent display, then don't render and
271
   * display a second set of exposed filter widgets.
285
   * If an attachment is set to inherit the exposed filter settings from its
286
   * parent display, then don't render and display a second set of exposed
287
   * filter widgets.
272 288
   */
273
  function displays_exposed() {
289
  public function displays_exposed() {
274 290
    return $this->options['inherit_exposed_filters'] ? FALSE : TRUE;
275 291
  }
276 292

  
277
  function use_pager() {
293
  /**
294
   * {@inheritdoc}
295
   */
296
  public function use_pager() {
278 297
    return !empty($this->use_pager);
279 298
  }
280 299

  
281
  function render_pager() {
300
  /**
301
   * {@inheritdoc}
302
   */
303
  public function render_pager() {
282 304
    return !empty($this->use_pager) && $this->get_option('render_pager');
283 305
  }
306

  
284 307
}

Formats disponibles : Unified diff