You are here

public function UserName::buildOptionsForm 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::buildOptionsForm()
  2. 10 core/modules/user/src/Plugin/views/argument_validator/UserName.php \Drupal\user\Plugin\views\argument_validator\UserName::buildOptionsForm()

Provides the default form for setting options.

Overrides User::buildOptionsForm

File

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

Class

UserName
Validates whether a user name is valid.

Namespace

Drupal\user\Plugin\views\argument_validator

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $entity_type = $this->entityTypeManager
    ->getDefinition('user');
  $form['multiple']['#options'] = [
    0 => $this
      ->t('Single name', [
      '%type' => $entity_type
        ->getLabel(),
    ]),
    1 => $this
      ->t('One or more names separated by , or +', [
      '%type' => $entity_type
        ->getLabel(),
    ]),
  ];
}