public function Term::processSummaryArguments

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::processSummaryArguments

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_validator/Term.php, line 185
Definition of Drupal\taxonomy\Plugin\views\argument_validator\Term.

Class

Term
Validate whether an argument is an acceptable node.

Namespace

Drupal\taxonomy\Plugin\views\argument_validator

Code

public function processSummaryArguments(&$args) {
  $type = $this->options['type'];
  $transform = $this->options['transform'];
  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;
    }
  }
}