You are here

public function UserName::processSummaryArguments in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/src/Plugin/views/argument_validator/UserName.php \Drupal\user\Plugin\views\argument_validator\UserName::processSummaryArguments()

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

File

core/modules/user/src/Plugin/views/argument_validator/UserName.php, line 70

Class

UserName
Validates whether a user name is valid.

Namespace

Drupal\user\Plugin\views\argument_validator

Code

public function processSummaryArguments(&$args) {

  // If the validation says the input is an username, we should reverse the
  // argument so it works for example for generation summary urls.
  $uids_arg_keys = array_flip($args);
  foreach ($this->userStorage
    ->loadMultiple($args) as $uid => $account) {
    $args[$uids_arg_keys[$uid]] = $account
      ->label();
  }
}