function UserName::buildOptionsForm

Same name in other branches
  1. 8.9.x 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()
  3. 11.x core/modules/user/src/Plugin/views/argument_validator/UserName.php \Drupal\user\Plugin\views\argument_validator\UserName::buildOptionsForm()

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

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