FormState::$rebuild

Same name in other branches
  1. 9 core/lib/Drupal/Core/Form/FormState.php \Drupal\Core\Form\FormState::rebuild
  2. 10 core/lib/Drupal/Core/Form/FormState.php \Drupal\Core\Form\FormState::rebuild
  3. 11.x core/lib/Drupal/Core/Form/FormState.php \Drupal\Core\Form\FormState::rebuild

Normally, after the entire form processing is completed and submit handlers have run, a form is considered to be done and \Drupal\Core\Form\FormSubmitterInterface::redirectForm() will redirect the user to a new page using a GET request (so a browser refresh does not re-submit the form). However, if 'rebuild' has been set to TRUE, then a new copy of the form is immediately built and sent to the browser, instead of a redirect. This is used for multi-step forms, such as wizards and confirmation forms. Normally, self::$rebuild is set by a submit handler, since it is usually logic within a submit handler that determines whether a form is done or requires another step. However, a validation handler may already set self::$rebuild to cause the form processing to bypass submit handlers and rebuild the form instead, even if there are no validation errors.

This property is uncacheable.

Type: bool

See also

self::setRebuild()

File

core/lib/Drupal/Core/Form/FormState.php, line 102

Class

FormState
Stores information about the state of a form.

Namespace

Drupal\Core\Form

Code

protected $rebuild = FALSE;

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