function FormTestGroupVerticalTabsForm::validateForm

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/form_test/src/Form/FormTestGroupVerticalTabsForm.php \Drupal\form_test\Form\FormTestGroupVerticalTabsForm::validateForm()
  2. 10 core/modules/system/tests/modules/form_test/src/Form/FormTestGroupVerticalTabsForm.php \Drupal\form_test\Form\FormTestGroupVerticalTabsForm::validateForm()

Overrides FormBase::validateForm

File

core/modules/system/tests/modules/form_test/src/Form/FormTestGroupVerticalTabsForm.php, line 57

Class

FormTestGroupVerticalTabsForm
Builds a simple form to test the #group property on #type 'vertical_tabs'.

Namespace

Drupal\form_test\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
    if ($form_state->getValue('element_2') === 'bad') {
        $form_state->setErrorByName('element_2', $this->t('there was an error'));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.