public function RemoveUserFromGroupAction::validateForm in Business Rules 8
Same name and namespace in other branches
- 2.x modules/br_group/src/Plugin/BusinessRulesAction/RemoveUserFromGroupAction.php \Drupal\br_group\Plugin\BusinessRulesAction\RemoveUserFromGroupAction::validateForm()
Plugin form validator.
If the plugin needs to perform a form validation, override this function.
Parameters
array $form: The form array.
\Drupal\Core\Form\FormStateInterface $form_state: The form state object.
Overrides BusinessRulesItemPluginBase::validateForm
File
- modules/
br_group/ src/ Plugin/ BusinessRulesAction/ RemoveUserFromGroupAction.php, line 85
Class
- RemoveUserFromGroupAction
- Class RemoveUserFromGroupAction.
Namespace
Drupal\br_group\Plugin\BusinessRulesActionCode
public function validateForm(array &$form, FormStateInterface $form_state) {
if ($form_state
->getValue('user_key') == 'username' && $form_state
->getValue('user_name') == '') {
$form_state
->setErrorByName('user_name', t('User name is required.'));
}
elseif ($form_state
->getValue('user_key') == 'userid' && $form_state
->getValue('user_id') == '') {
$form_state
->setErrorByName('user_id', t('User id is required.'));
}
}