You are here

public function Name::adminSummary in Drupal 8

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()

Display the filter on the administrative summary

Overrides InOperator::adminSummary

File

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

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();
}