function ChangeUserRoleBase::buildConfigurationForm

Same name in other branches
  1. 8.9.x core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php \Drupal\user\Plugin\Action\ChangeUserRoleBase::buildConfigurationForm()
  2. 10 core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php \Drupal\user\Plugin\Action\ChangeUserRoleBase::buildConfigurationForm()
  3. 11.x core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php \Drupal\user\Plugin\Action\ChangeUserRoleBase::buildConfigurationForm()

Overrides PluginFormInterface::buildConfigurationForm

File

core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php, line 60

Class

ChangeUserRoleBase
Provides a base class for operations to change a user's role.

Namespace

Drupal\user\Plugin\Action

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $roles = user_role_names(TRUE);
    unset($roles[RoleInterface::AUTHENTICATED_ID]);
    $form['rid'] = [
        '#type' => 'radios',
        '#title' => $this->t('Role'),
        '#options' => $roles,
        '#default_value' => $this->configuration['rid'],
        '#required' => TRUE,
    ];
    return $form;
}

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