function FormTestStoragePageCacheForm::validateForm

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/form_test/src/Form/FormTestStoragePageCacheForm.php \Drupal\form_test\Form\FormTestStoragePageCacheForm::validateForm()
  2. 10 core/modules/system/tests/modules/form_test/src/Form/FormTestStoragePageCacheForm.php \Drupal\form_test\Form\FormTestStoragePageCacheForm::validateForm()
  3. 8.9.x core/modules/system/tests/modules/form_test/src/Form/FormTestStoragePageCacheForm.php \Drupal\form_test\Form\FormTestStoragePageCacheForm::validateForm()

Overrides FormBase::validateForm

File

core/modules/system/tests/modules/form_test/src/Form/FormTestStoragePageCacheForm.php, line 74

Class

FormTestStoragePageCacheForm
Form to test page cache storage.

Namespace

Drupal\form_test\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  // Test using form cache when re-displaying a form due to validation
  // errors.
  if ($form_state->hasAnyErrors()) {
    $form_state->setCached();
  }
}

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