function FormStatePersistTest::setStateRebuildValue

Form API #process callback.

Set form state properties based on whether form is rebuilding.

File

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

Class

FormStatePersistTest
Tests that the form state persists across multiple requests.

Namespace

Drupal\Tests\system\Kernel\Form

Code

public static function setStateRebuildValue(array $form, FormStateInterface $form_state) : array {
  if (!$form_state->isRebuilding()) {
    $form_state->set('process', TRUE);
    return $form;
  }
  $form_state->set('rebuild', TRUE);
  return $form;
}

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