public function views_plugin_argument_validate_taxonomy_term::process_summary_arguments in Views (for Drupal 7) 7.3
Process the summary arguments for displaying.
Some plugins alter the argument so it uses something else internally. For example the user validation set's the argument to the uid, for a faster query. But there are use cases where you want to use the old value again, for example the summary.
Overrides views_plugin_argument_validate::process_summary_arguments
File
- modules/
taxonomy/ views_plugin_argument_validate_taxonomy_term.inc, line 220 - Definition of views_plugin_argument_validate_taxonomy_term.
Class
- views_plugin_argument_validate_taxonomy_term
- Validate whether an argument is an acceptable node.
Code
public function process_summary_arguments(&$args) {
$type = $this->options['type'];
$transform = $this->options['transform'];
$vocabularies = array_filter($this->options['vocabularies']);
if ($type == 'convert') {
$arg_keys = array_flip($args);
$query = db_select('taxonomy_term_data', 'td');
$query
->addTag('taxonomy_term_access');
$query
->condition('td.tid', $args);
$query
->addField('td', 'tid', 'tid');
if (!empty($vocabularies)) {
$query
->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
$query
->condition('tv.machine_name', $vocabularies);
}
if ($transform) {
$query
->addExpression("REPLACE(td.name, ' ', '-')", 'name');
}
else {
$query
->addField('td', 'name', 'name');
}
foreach ($query
->execute()
->fetchAllKeyed() as $tid => $term) {
$args[$arg_keys[$tid]] = $term;
}
}
}