You are here

public function ChangeUserRoleBase::buildConfigurationForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php \Drupal\user\Plugin\Action\ChangeUserRoleBase::buildConfigurationForm()
  2. 9 core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php \Drupal\user\Plugin\Action\ChangeUserRoleBase::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' => t('Role'),
    '#options' => $roles,
    '#default_value' => $this->configuration['rid'],
    '#required' => TRUE,
  ];
  return $form;
}