You are here

function User::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/user/Plugin/views/argument_validator/User.php, line 140
Definition of Views\user\Plugin\views\argument_validator\User.

Class

User
Validate whether an argument is a valid user.

Namespace

Views\user\Plugin\views\argument_validator

Code

function process_summary_arguments(&$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);
  if ($this->options['type'] == 'name') {
    $users = user_load_multiple($args);
    foreach ($users as $uid => $account) {
      $args[$uids_arg_keys[$uid]] = $account->name;
    }
  }
}