function FormTestStorageForm::elementValidateValueCached
Same name in other branches
- 9 core/modules/system/tests/modules/form_test/src/Form/FormTestStorageForm.php \Drupal\form_test\Form\FormTestStorageForm::elementValidateValueCached()
- 10 core/modules/system/tests/modules/form_test/src/Form/FormTestStorageForm.php \Drupal\form_test\Form\FormTestStorageForm::elementValidateValueCached()
- 11.x core/modules/system/tests/modules/form_test/src/Form/FormTestStorageForm.php \Drupal\form_test\Form\FormTestStorageForm::elementValidateValueCached()
Form element validation handler for 'value' element.
Tests updating of cached form storage during validation.
File
-
core/
modules/ system/ tests/ modules/ form_test/ src/ Form/ FormTestStorageForm.php, line 116
Class
- FormTestStorageForm
- A multistep form for testing the form storage.
Namespace
Drupal\form_test\FormCode
public function elementValidateValueCached($element, FormStateInterface $form_state) {
// If caching is enabled and we receive a certain value, change the storage.
// This presumes that another submitted form value triggers a validation error
// elsewhere in the form. Form API should still update the cached form storage
// though.
if ($this->getRequest()
->get('cache') && $form_state->getValue('value') == 'change_title') {
$form_state->set([
'thing',
'changed',
], TRUE);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.