function FormTestVerticalTabsAccessForm::validateForm
Same name in other branches
- 9 core/modules/system/tests/modules/form_test/src/Form/FormTestVerticalTabsAccessForm.php \Drupal\form_test\Form\FormTestVerticalTabsAccessForm::validateForm()
- 10 core/modules/system/tests/modules/form_test/src/Form/FormTestVerticalTabsAccessForm.php \Drupal\form_test\Form\FormTestVerticalTabsAccessForm::validateForm()
- 11.x core/modules/system/tests/modules/form_test/src/Form/FormTestVerticalTabsAccessForm.php \Drupal\form_test\Form\FormTestVerticalTabsAccessForm::validateForm()
Overrides FormBase::validateForm
File
-
core/
modules/ system/ tests/ modules/ form_test/ src/ Form/ FormTestVerticalTabsAccessForm.php, line 107
Class
- FormTestVerticalTabsAccessForm
- Builds a form to test vertical tabs access.
Namespace
Drupal\form_test\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$values = $form_state->getValues();
if (empty($values['field1'])) {
$form_state->setErrorByName('tab1][field1', t('This checkbox inside a vertical tab does not have its default value.'));
}
if ($values['field2'] != 'field2') {
$form_state->setErrorByName('tab2][field2', t('This textfield inside a vertical tab does not have its default value.'));
}
if (empty($values['field3'])) {
$form_state->setErrorByName('fieldset][field3', t('This checkbox inside a fieldset does not have its default value.'));
}
if (empty($values['field4'])) {
$form_state->setErrorByName('container][field4', t('This checkbox inside a container does not have its default value.'));
}
if (empty($values['field5'])) {
$form_state->setErrorByName('container][subcontainer][field5', t('This checkbox inside a nested container does not have its default value.'));
}
if (empty($values['field5'])) {
$form_state->setErrorByName('tab3][field6', t('This checkbox inside a vertical tab whose fieldset access is allowed does not have its default value.'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.