Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc | ||
---|---|---|
11 | 11 |
* @ingroup views_filter_handlers |
12 | 12 |
*/ |
13 | 13 |
class views_handler_filter_term_node_tid extends views_handler_filter_many_to_one { |
14 |
// Stores the exposed input for this filter. |
|
15 |
var $validated_exposed_input = NULL; |
|
16 | 14 |
|
17 |
function init(&$view, &$options) { |
|
15 |
/** |
|
16 |
* Stores the exposed input for this filter. |
|
17 |
*/ |
|
18 |
public $validated_exposed_input = NULL; |
|
19 |
|
|
20 |
/** |
|
21 |
* {@inheritdoc} |
|
22 |
*/ |
|
23 |
public function init(&$view, &$options) { |
|
18 | 24 |
parent::init($view, $options); |
19 | 25 |
if (!empty($this->definition['vocabulary'])) { |
20 | 26 |
$this->options['vocabulary'] = $this->definition['vocabulary']; |
... | ... | |
30 | 36 |
} |
31 | 37 |
} |
32 | 38 |
|
33 |
function has_extra_options() { return TRUE; } |
|
39 |
/** |
|
40 |
* {@inheritdoc} |
|
41 |
*/ |
|
42 |
public function has_extra_options() { |
|
43 |
return TRUE; |
|
44 |
} |
|
34 | 45 |
|
35 |
function get_value_options() { /* don't overwrite the value options */ } |
|
46 |
/** |
|
47 |
* {@inheritdoc} |
|
48 |
*/ |
|
49 |
public function get_value_options() { |
|
50 |
// Don't overwrite the value options. |
|
51 |
} |
|
36 | 52 |
|
37 |
function option_definition() { |
|
53 |
/** |
|
54 |
* {@inheritdoc} |
|
55 |
*/ |
|
56 |
public function option_definition() { |
|
38 | 57 |
$options = parent::option_definition(); |
39 | 58 |
|
40 | 59 |
$options['type'] = array('default' => 'textfield'); |
... | ... | |
46 | 65 |
return $options; |
47 | 66 |
} |
48 | 67 |
|
49 |
function extra_options_form(&$form, &$form_state) { |
|
68 |
/** |
|
69 |
* {@inheritdoc} |
|
70 |
*/ |
|
71 |
public function extra_options_form(&$form, &$form_state) { |
|
50 | 72 |
$vocabularies = taxonomy_get_vocabularies(); |
51 | 73 |
$options = array(); |
52 | 74 |
foreach ($vocabularies as $voc) { |
... | ... | |
86 | 108 |
); |
87 | 109 |
} |
88 | 110 |
|
89 |
function value_form(&$form, &$form_state) { |
|
111 |
/** |
|
112 |
* {@inheritdoc} |
|
113 |
*/ |
|
114 |
public function value_form(&$form, &$form_state) { |
|
90 | 115 |
$vocabulary = taxonomy_vocabulary_machine_name_load($this->options['vocabulary']); |
91 | 116 |
if (empty($vocabulary) && $this->options['limit']) { |
92 | 117 |
$form['markup'] = array( |
... | ... | |
123 | 148 |
$options = array(); |
124 | 149 |
|
125 | 150 |
if ($tree) { |
126 |
// Translation system needs full entity objects, so we have access to label. |
|
151 |
// Translation system needs full entity objects, so we have access to |
|
152 |
// label. |
|
127 | 153 |
foreach ($tree as $term) { |
128 | 154 |
$choice = new stdClass(); |
129 | 155 |
$choice->option = array($term->tid => str_repeat('-', $term->depth) . entity_label('taxonomy_term', $term)); |
... | ... | |
177 | 203 |
$keys = array_keys($options); |
178 | 204 |
$default_value = array_shift($keys); |
179 | 205 |
} |
180 |
// Due to #1464174 there is a chance that array('') was saved in the admin ui.
|
|
181 |
// Let's choose a safe default value. |
|
206 |
// Due to #1464174 there is a chance that array('') was saved in the |
|
207 |
// admin UI. Let's choose a safe default value.
|
|
182 | 208 |
elseif ($default_value == array('')) { |
183 | 209 |
$default_value = 'All'; |
184 | 210 |
} |
... | ... | |
212 | 238 |
} |
213 | 239 |
} |
214 | 240 |
|
215 |
function value_validate($form, &$form_state) { |
|
241 |
/** |
|
242 |
* {@inheritdoc} |
|
243 |
*/ |
|
244 |
public function value_validate($form, &$form_state) { |
|
216 | 245 |
// We only validate if they've chosen the text field style. |
217 | 246 |
if ($this->options['type'] != 'textfield') { |
218 | 247 |
return; |
... | ... | |
226 | 255 |
} |
227 | 256 |
} |
228 | 257 |
|
229 |
function accept_exposed_input($input) { |
|
258 |
/** |
|
259 |
* {@inheritdoc} |
|
260 |
*/ |
|
261 |
public function accept_exposed_input($input) { |
|
230 | 262 |
if (empty($this->options['exposed'])) { |
231 | 263 |
return TRUE; |
232 | 264 |
} |
... | ... | |
266 | 298 |
return $rc; |
267 | 299 |
} |
268 | 300 |
|
269 |
function exposed_validate(&$form, &$form_state) { |
|
301 |
/** |
|
302 |
* {@inheritdoc} |
|
303 |
*/ |
|
304 |
public function exposed_validate(&$form, &$form_state) { |
|
270 | 305 |
if (empty($this->options['exposed'])) { |
271 | 306 |
return; |
272 | 307 |
} |
... | ... | |
298 | 333 |
* or the exposed filter, this is abstracted out a bit so it can |
299 | 334 |
* handle the multiple input sources. |
300 | 335 |
* |
301 |
* @param $form |
|
336 |
* @param array $form
|
|
302 | 337 |
* The form which is used, either the views ui or the exposed filters. |
303 |
* @param $values |
|
338 |
* @param array $values
|
|
304 | 339 |
* The taxonomy names which will be converted to tids. |
305 | 340 |
* |
306 | 341 |
* @return array |
307 | 342 |
* The taxonomy ids fo all validated terms. |
308 | 343 |
*/ |
309 |
function validate_term_strings(&$form, $values) { |
|
344 |
public function validate_term_strings(&$form, $values) {
|
|
310 | 345 |
if (empty($values)) { |
311 | 346 |
return array(); |
312 | 347 |
} |
... | ... | |
345 | 380 |
return $tids; |
346 | 381 |
} |
347 | 382 |
|
348 |
function value_submit($form, &$form_state) { |
|
383 |
/** |
|
384 |
* {@inheritdoc} |
|
385 |
*/ |
|
386 |
public function value_submit($form, &$form_state) { |
|
349 | 387 |
// prevent array_filter from messing up our arrays in parent submit. |
350 | 388 |
} |
351 | 389 |
|
352 |
function expose_form(&$form, &$form_state) { |
|
390 |
/** |
|
391 |
* {@inheritdoc} |
|
392 |
*/ |
|
393 |
public function expose_form(&$form, &$form_state) { |
|
353 | 394 |
parent::expose_form($form, $form_state); |
354 | 395 |
if ($this->options['type'] != 'select') { |
355 | 396 |
unset($form['expose']['reduce']); |
... | ... | |
361 | 402 |
); |
362 | 403 |
} |
363 | 404 |
|
364 |
function admin_summary() { |
|
405 |
/** |
|
406 |
* {@inheritdoc} |
|
407 |
*/ |
|
408 |
public function admin_summary() { |
|
365 | 409 |
// set up $this->value_options for the parent summary |
366 | 410 |
$this->value_options = array(); |
367 | 411 |
|
... | ... | |
374 | 418 |
} |
375 | 419 |
return parent::admin_summary(); |
376 | 420 |
} |
421 |
|
|
377 | 422 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules