Révision 6eb8d15f
Ajouté par Assos Assos il y a presque 10 ans
drupal7/sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc | ||
---|---|---|
98 | 98 |
if ($this->options['type'] == 'textfield') { |
99 | 99 |
$default = ''; |
100 | 100 |
if ($this->value) { |
101 |
$result = db_select('taxonomy_term_data', 'td') |
|
102 |
->fields('td') |
|
103 |
->condition('td.tid', $this->value) |
|
104 |
->execute(); |
|
105 |
foreach ($result as $term) { |
|
101 |
$result = taxonomy_term_load_multiple($this->value); |
|
102 |
foreach ($result as $entity_term) { |
|
106 | 103 |
if ($default) { |
107 | 104 |
$default .= ', '; |
108 | 105 |
} |
109 |
$default .= $term->name;
|
|
106 |
$default .= entity_label('taxonomy_term', $entity_term);
|
|
110 | 107 |
} |
111 | 108 |
} |
112 | 109 |
|
... | ... | |
122 | 119 |
} |
123 | 120 |
else { |
124 | 121 |
if (!empty($this->options['hierarchy']) && $this->options['limit']) { |
125 |
$tree = taxonomy_get_tree($vocabulary->vid); |
|
122 |
$tree = taxonomy_get_tree($vocabulary->vid, 0, NULL, TRUE);
|
|
126 | 123 |
$options = array(); |
127 | 124 |
|
128 | 125 |
if ($tree) { |
126 |
// Translation system needs full entity objects, so we have access to label. |
|
129 | 127 |
foreach ($tree as $term) { |
130 | 128 |
$choice = new stdClass(); |
131 |
$choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
|
|
129 |
$choice->option = array($term->tid => str_repeat('-', $term->depth) . entity_label('taxonomy_term', $term));
|
|
132 | 130 |
$options[] = $choice; |
133 | 131 |
} |
134 | 132 |
} |
... | ... | |
147 | 145 |
$query->condition('tv.machine_name', $vocabulary->machine_name); |
148 | 146 |
} |
149 | 147 |
$result = $query->execute(); |
148 |
|
|
149 |
$tids = array(); |
|
150 | 150 |
foreach ($result as $term) { |
151 |
$options[$term->tid] = $term->name; |
|
151 |
$tids[] = $term->tid; |
|
152 |
} |
|
153 |
$entities = taxonomy_term_load_multiple($tids); |
|
154 |
foreach ($entities as $entity_term) { |
|
155 |
$options[$entity_term->tid] = entity_label('taxonomy_term', $entity_term); |
|
152 | 156 |
} |
153 | 157 |
} |
154 | 158 |
|
... | ... | |
238 | 242 |
$rc = parent::accept_exposed_input($input); |
239 | 243 |
if ($rc) { |
240 | 244 |
// If we have previously validated input, override. |
241 |
if (isset($this->validated_exposed_input)) { |
|
245 |
if (!$this->is_a_group() && isset($this->validated_exposed_input)) {
|
|
242 | 246 |
$this->value = $this->validated_exposed_input; |
243 | 247 |
} |
244 | 248 |
} |
... | ... | |
347 | 351 |
|
348 | 352 |
if ($this->value) { |
349 | 353 |
$this->value = array_filter($this->value); |
350 |
$result = db_select('taxonomy_term_data', 'td') |
|
351 |
->fields('td') |
|
352 |
->condition('td.tid', $this->value) |
|
353 |
->execute(); |
|
354 |
foreach ($result as $term) { |
|
355 |
$this->value_options[$term->tid] = $term->name; |
|
354 |
$result = taxonomy_term_load_multiple($this->value); |
|
355 |
foreach ($result as $entity_term) { |
|
356 |
$this->value_options[$entity_term->tid] = entity_label('taxonomy_term', $entity_term); |
|
356 | 357 |
} |
357 | 358 |
} |
358 | 359 |
return parent::admin_summary(); |
Formats disponibles : Unified diff
Weekly update of contrib modules