function FormStatePersistTest::submitForm

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

core/modules/system/tests/src/Kernel/Form/FormStatePersistTest.php, line 92

Class

FormStatePersistTest
Tests that the form state persists across multiple requests.

Namespace

Drupal\Tests\system\Kernel\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) : void {
  // Save the values retrieved from form state storage during form submit, so
  // the values can be confirmed in test assertions.
  static::$submitStoragePersist['build'] = (bool) $form_state->get('build');
  static::$submitStoragePersist['process'] = (bool) $form_state->get('process');
  static::$submitStoragePersist['rebuild'] = (bool) $form_state->get('rebuild');
  $form_state->setRebuild();
}

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