3 namespace Drupal\form_test\Form;
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
9 * Form constructor for testing form state persistence.
13 class FormTestStatePersistForm extends FormBase {
18 public function getFormId() {
19 return 'form_test_state_persist';
25 public function buildForm(array $form, FormStateInterface $form_state) {
27 '#type' => 'textfield',
29 '#default_value' => 'DEFAULT',
32 $form_state->set('value', 'State persisted.');
36 '#value' => t('Submit'),
44 public function submitForm(array &$form, FormStateInterface $form_state) {
45 drupal_set_message($form_state->get('value'));
46 $form_state->setRebuild();