function UserRole::buildConfigurationForm
Overrides ConditionPluginBase::buildConfigurationForm
File
-
core/
modules/ user/ src/ Plugin/ Condition/ UserRole.php, line 32
Class
- UserRole
- Provides a 'User Role' condition.
Namespace
Drupal\user\Plugin\ConditionCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['roles'] = [
'#type' => 'checkboxes',
'#title' => $this->t('When the user has the following roles'),
'#default_value' => $this->configuration['roles'],
'#options' => array_map(fn(RoleInterface $role) => Html::escape($role->label()), Role::loadMultiple()),
'#description' => $this->t('If you select no roles, the condition will evaluate to TRUE for all users.'),
];
return parent::buildConfigurationForm($form, $form_state);
}