public function AutofloatSettingsForm::validateForm in AutoFloat 8
Form validation handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormBase::validateForm
File
- src/
Form/ AutofloatSettingsForm.php, line 83
Class
- AutofloatSettingsForm
- Class AutofloatSettingsForm.
Namespace
Drupal\autofloat\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
// Accept maximum two class value for the selector field.
$limit = $form_state
->getValue('autofloat_selector');
if (substr_count($limit, ',') > 1) {
$form_state
->setErrorByName('autofloat_selector', $this
->t('Not more than two values.'));
}
// Accept maximum two class value for the rejector field.
$limit = $form_state
->getValue('autofloat_rejector');
if (substr_count($limit, ',') > 1) {
$form_state
->setErrorByName('autofloat_rejector', $this
->t('Not more than two values.'));
}
parent::validateForm($form, $form_state);
}