function Name::adminSummary

Overrides InOperator::adminSummary

File

core/modules/user/src/Plugin/views/filter/Name.php, line 111

Class

Name
Filter handler for usernames.

Namespace

Drupal\user\Plugin\views\filter

Code

public function adminSummary() {
  // set up $this->valueOptions for the parent summary
  $this->valueOptions = [];
  if ($this->value) {
    $result = \Drupal::entityTypeManager()->getStorage('user')
      ->loadByProperties([
      'uid' => $this->value,
    ]);
    foreach ($result as $account) {
      if ($account->id()) {
        $this->valueOptions[$account->id()] = $account->label();
      }
      else {
        // Intentionally NOT translated.
        $this->valueOptions[$account->id()] = 'Anonymous';
      }
    }
  }
  return parent::adminSummary();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.