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_depth_join.inc | ||
---|---|---|
14 | 14 |
* @ingroup views_filter_handlers |
15 | 15 |
*/ |
16 | 16 |
class views_handler_filter_term_node_tid_depth_join extends views_handler_filter_term_node_tid { |
17 |
function operator_options($which = 'title') { |
|
17 |
|
|
18 |
/** |
|
19 |
* {@inheritdoc} |
|
20 |
*/ |
|
21 |
public function operator_options($which = 'title') { |
|
18 | 22 |
return array( |
19 | 23 |
'or' => t('Is one of'), |
20 | 24 |
); |
21 | 25 |
} |
22 | 26 |
|
23 |
function option_definition() { |
|
27 |
/** |
|
28 |
* {@inheritdoc} |
|
29 |
*/ |
|
30 |
public function option_definition() { |
|
24 | 31 |
$options = parent::option_definition(); |
25 | 32 |
|
26 | 33 |
$options['depth'] = array('default' => 0); |
... | ... | |
28 | 35 |
return $options; |
29 | 36 |
} |
30 | 37 |
|
31 |
function extra_options_form(&$form, &$form_state) { |
|
38 |
/** |
|
39 |
* {@inheritdoc} |
|
40 |
*/ |
|
41 |
public function extra_options_form(&$form, &$form_state) { |
|
32 | 42 |
parent::extra_options_form($form, $form_state); |
33 | 43 |
|
34 | 44 |
$form['depth'] = array( |
... | ... | |
39 | 49 |
); |
40 | 50 |
} |
41 | 51 |
|
42 |
function query() { |
|
52 |
/** |
|
53 |
* {@inheritdoc} |
|
54 |
*/ |
|
55 |
public function query() { |
|
43 | 56 |
// If no filter values are present, then do nothing. |
44 | 57 |
if (count($this->value) == 0) { |
45 | 58 |
return; |
... | ... | |
52 | 65 |
$operator = '='; |
53 | 66 |
} |
54 | 67 |
else { |
55 |
$operator = 'IN';# " IN (" . implode(', ', array_fill(0, sizeof($this->value), '%d')) . ")"; |
|
68 |
$operator = 'IN'; |
|
69 |
// " IN (" |
|
70 |
// . implode(', ', array_fill(0, sizeof($this->value), '%d')) |
|
71 |
// . ")"; |
|
56 | 72 |
} |
57 | 73 |
|
58 | 74 |
// The normal use of ensure_my_table() here breaks Views. |
... | ... | |
72 | 88 |
} |
73 | 89 |
|
74 | 90 |
// The tids variable can be an integer or an array of integers. |
75 |
$tids = is_array($this->value) ? $this->value : array($this->value);
|
|
91 |
$tids = is_array($this->value) ? $this->value : array($this->value); |
|
76 | 92 |
|
77 | 93 |
if ($this->options['depth'] > 0) { |
78 | 94 |
// When the depth is positive search the children. |
... | ... | |
135 | 151 |
'field' => 'tid', |
136 | 152 |
'value' => $tids, |
137 | 153 |
'operator' => $operator, |
138 |
) |
|
154 |
),
|
|
139 | 155 |
); |
140 | 156 |
$taxonomy_index_alias = $this->query->add_relationship('taxonomy_index', $join, 'node'); |
141 | 157 |
} |
158 |
|
|
142 | 159 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules