function ChangeUserRoleBase::buildConfigurationForm
Same name in other branches
- 9 core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php \Drupal\user\Plugin\Action\ChangeUserRoleBase::buildConfigurationForm()
- 8.9.x core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php \Drupal\user\Plugin\Action\ChangeUserRoleBase::buildConfigurationForm()
- 10 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 61
Class
- ChangeUserRoleBase
- Provides a base class for operations to change a user's role.
Namespace
Drupal\user\Plugin\ActionCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$roles = Role::loadMultiple();
unset($roles[RoleInterface::ANONYMOUS_ID]);
unset($roles[RoleInterface::AUTHENTICATED_ID]);
$roles = array_map(fn(RoleInterface $role) => $role->label(), $roles);
$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.