public function AddUserToGroupAction::getSettingsForm in Business Rules 2.x
Same name and namespace in other branches
- 8 modules/br_group/src/Plugin/BusinessRulesAction/AddUserToGroupAction.php \Drupal\br_group\Plugin\BusinessRulesAction\AddUserToGroupAction::getSettingsForm()
Return the form array.
@internal param array $form
Parameters
array $form: The form array.
\Drupal\Core\Form\FormStateInterface $form_state: The form state object.
\Drupal\business_rules\ItemInterface $item: The configured item.
Return value
array The render array for the settings form.
Overrides BusinessRulesItemPluginBase::getSettingsForm
File
- modules/
br_group/ src/ Plugin/ BusinessRulesAction/ AddUserToGroupAction.php, line 35
Class
- AddUserToGroupAction
- Class AddUserToGroupAction.
Namespace
Drupal\br_group\Plugin\BusinessRulesActionCode
public function getSettingsForm(array &$form, FormStateInterface $form_state, ItemInterface $item) {
$settings['group_id'] = [
'#type' => 'textfield',
'#title' => t('Group Id'),
'#required' => TRUE,
'#description' => t('The group id to add the user. You may use variable or token to fill this information'),
'#default_value' => $item
->getSettings('group_id'),
];
$settings['user_key'] = [
'#type' => 'radios',
'#title' => t('Key to add the user on the group'),
'#default_value' => $item
->getSettings('user_key') ?: 'username',
'#options' => [
'username' => t('User Name'),
'userid' => t('User Id'),
],
];
$settings['user_name'] = [
'#type' => 'textfield',
'#title' => t('User Name'),
'#description' => t('The user name of the user to be added on the group. You may use variable or token to fill this information'),
'#default_value' => $item
->getSettings('user_name'),
'#states' => [
'visible' => [
':input[name="user_key"]' => [
'value' => 'username',
],
],
],
];
$settings['user_id'] = [
'#type' => 'textfield',
'#title' => t('User Id'),
'#description' => t('The user id of the user to be added on the group. You may use variable or token to fill this information'),
'#default_value' => $item
->getSettings('user_id'),
'#states' => [
'visible' => [
':input[name="user_key"]' => [
'value' => 'userid',
],
],
],
];
return $settings;
}