function UserRole::buildConfigurationForm
Same name in other branches
- 9 core/modules/user/src/Plugin/Condition/UserRole.php \Drupal\user\Plugin\Condition\UserRole::buildConfigurationForm()
- 8.9.x core/modules/user/src/Plugin/Condition/UserRole.php \Drupal\user\Plugin\Condition\UserRole::buildConfigurationForm()
- 10 core/modules/user/src/Plugin/Condition/UserRole.php \Drupal\user\Plugin\Condition\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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.