public function RolesConditionCreator::createConditionElements in Block Visibility Groups 8
Create condition elements for form.
Return value
array
Overrides ConditionCreatorBase::createConditionElements
File
- block_visibility_groups_admin/
src/ Plugin/ ConditionCreator/ RolesConditionCreator.php, line 28
Class
- RolesConditionCreator
- A condition creator to be used in creating user role condition.
Namespace
Drupal\block_visibility_groups_admin\Plugin\ConditionCreatorCode
public function createConditionElements() {
$elements['condition_config'] = [
'#tree' => TRUE,
];
// @todo Dynamically create condition for by call ConditionPluginBase::buildConfigurationForm?
$elements['condition_config']['roles'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('When the user has the following roles'),
'#options' => array_map('\\Drupal\\Component\\Utility\\Html::escape', user_role_names()),
];
return $elements;
}