You are here

function Term::process_summary_arguments in Views (for Drupal 7) 8.3

Process the summary arguments for displaying.

Some plugins alter the argument so it uses something else interal. 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 ArgumentValidatorPluginBase::process_summary_arguments

File

lib/Views/taxonomy/Plugin/views/argument_validator/Term.php, line 180
Definition of Views\taxonomy\Plugin\views\argument_validator\Term.

Class

Term
Validate whether an argument is an acceptable node.

Namespace

Views\taxonomy\Plugin\views\argument_validator

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);
    $result = entity_load_multiple('taxonomy_term', $args);
    if ($transform) {
      foreach ($result as $term) {
        $term->name = str_replace(' ', '-', $term->name);
      }
    }
    foreach ($result as $tid => $term) {
      $args[$arg_keys[$tid]] = $term;
    }
  }
}