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/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc
2 2

  
3 3
/**
4 4
 * @file
5
 * Contains the 'taxonomy term' argument validator plugin.
5
 * Definition of views_plugin_argument_validate_taxonomy_term.
6 6
 */
7 7

  
8 8
/**
9 9
 * Validate whether an argument is an acceptable node.
10 10
 */
11 11
class views_plugin_argument_validate_taxonomy_term extends views_plugin_argument_validate {
12
  function init(&$view, &$argument, $options) {
12

  
13
  /**
14
   * {@inheritdoc}
15
   */
16
  public function init(&$view, &$argument, $options) {
13 17
    parent::init($view, $argument, $options);
14 18

  
15 19
    // Convert legacy vids option to machine name vocabularies.
......
23 27
    }
24 28
  }
25 29

  
26
  function option_definition() {
30
  /**
31
   * {@inheritdoc}
32
   */
33
  public function option_definition() {
27 34
    $options = parent::option_definition();
28 35
    $options['vocabularies'] = array('default' => array());
29 36
    $options['type'] = array('default' => 'tid');
......
32 39
    return $options;
33 40
  }
34 41

  
35
  function options_form(&$form, &$form_state) {
42
  /**
43
   * {@inheritdoc}
44
   */
45
  public function options_form(&$form, &$form_state) {
36 46
    $vocabularies = taxonomy_get_vocabularies();
37 47
    $options = array();
38 48
    foreach ($vocabularies as $voc) {
......
69 79
    );
70 80
  }
71 81

  
72
  function options_submit(&$form, &$form_state, &$options = array()) {
82
  /**
83
   * {@inheritdoc}
84
   */
85
  public function options_submit(&$form, &$form_state, &$options = array()) {
73 86
    // Filter unselected items so we don't unnecessarily store giant arrays.
74 87
    $options['vocabularies'] = array_filter($options['vocabularies']);
75 88
  }
76 89

  
77
  function convert_options(&$options) {
90
  /**
91
   * {@inheritdoc}
92
   */
93
  public function convert_options(&$options) {
78 94
    if (!isset($options['vocabularies']) && !empty($this->argument->options['validate_argument_vocabulary'])) {
79 95
      $options['vocabularies'] = $this->argument->options['validate_argument_vocabulary'];
80 96
      $options['type'] = $this->argument->options['validate_argument_type'];
......
82 98
    }
83 99
  }
84 100

  
85
  function validate_argument($argument) {
101
  /**
102
   * {@inheritdoc}
103
   */
104
  public function validate_argument($argument) {
86 105
    $vocabularies = array_filter($this->options['vocabularies']);
87 106
    $type = $this->options['type'];
88 107
    $transform = $this->options['transform'];
......
122 141
        $test = drupal_map_assoc($tids->value);
123 142
        $titles = array();
124 143

  
125
        // check, if some tids already verified
144
        // check, if some tids already verified.
126 145
        static $validated_cache = array();
127 146
        foreach ($test as $tid) {
128 147
          if (isset($validated_cache[$tid])) {
......
136 155
          }
137 156
        }
138 157

  
139
        // if unverified tids left - verify them and cache results
158
        // if unverified tids left - verify them and cache results.
140 159
        if (count($test)) {
141 160
          $query = db_select('taxonomy_term_data', 'td');
142 161
          $query->addTag('taxonomy_term_access');
......
158 177
          }
159 178
        }
160 179

  
161
        // Remove duplicate titles
180
        // Remove duplicate titles.
162 181
        $titles = array_unique($titles);
163 182

  
164 183
        $this->argument->validated_title = implode($tids->operator == 'or' ? ' + ' : ', ', $titles);
......
195 214
    }
196 215
  }
197 216

  
198
  function process_summary_arguments(&$args) {
217
  /**
218
   * {@inheritdoc}
219
   */
220
  public function process_summary_arguments(&$args) {
199 221
    $type = $this->options['type'];
200 222
    $transform = $this->options['transform'];
201 223
    $vocabularies = array_filter($this->options['vocabularies']);
......
223 245
      }
224 246
    }
225 247
  }
248

  
226 249
}

Formats disponibles : Unified diff