1 views_plugin_argument_validate_taxonomy_term.inc views_plugin_argument_validate_taxonomy_term::process_summary_arguments(&$args)

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

core/modules/taxonomy/views/views_plugin_argument_validate_taxonomy_term.inc, line 192
Contains the 'taxonomy term' argument validator plugin.

Class

views_plugin_argument_validate_taxonomy_term
Validate whether an argument is an acceptable node.

Code

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->condition('td.vocabulary', $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;
    }
  }
}