Projet

Général

Profil

Paste
Télécharger (1,13 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / plugins / views_plugin_argument_default_fixed.inc @ 5d12d676

1
<?php
2

    
3
/**
4
 * @file
5
 * Definition of views_plugin_argument_default_fixed.
6
 */
7

    
8
/**
9
 * The fixed argument default handler.
10
 *
11
 * @ingroup views_argument_default_plugins
12
 */
13
class views_plugin_argument_default_fixed extends views_plugin_argument_default {
14

    
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function option_definition() {
19
    $options = parent::option_definition();
20
    $options['argument'] = array('default' => '');
21

    
22
    return $options;
23
  }
24

    
25
  /**
26
   * {@inheritdoc}
27
   */
28
  public function options_form(&$form, &$form_state) {
29
    parent::options_form($form, $form_state);
30
    $form['argument'] = array(
31
      '#type' => 'textfield',
32
      '#title' => t('Fixed value'),
33
      '#default_value' => $this->options['argument'],
34
    );
35
  }
36

    
37
  /**
38
   * Return the default argument.
39
   */
40
  public function get_argument() {
41
    return $this->options['argument'];
42
  }
43

    
44
  /**
45
   * {@inheritdoc}
46
   */
47
  public function convert_options(&$options) {
48
    if (!isset($options['argument']) && isset($this->argument->options['default_argument_fixed'])) {
49
      $options['argument'] = $this->argument->options['default_argument_fixed'];
50
    }
51
  }
52

    
53
}
54

    
55
/**
56
 * @}
57
 */