function Name::adminSummary

Same name and namespace in other branches
  1. 9 core/modules/user/src/Plugin/views/filter/Name.php \Drupal\user\Plugin\views\filter\Name::adminSummary()
  2. 8.9.x core/modules/user/src/Plugin/views/filter/Name.php \Drupal\user\Plugin\views\filter\Name::adminSummary()
  3. 10 core/modules/user/src/Plugin/views/filter/Name.php \Drupal\user\Plugin\views\filter\Name::adminSummary()

Overrides InOperator::adminSummary

File

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

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.