Skip to content
Snippets Groups Projects
Commit ceb626e6 authored by Brandon Lira's avatar Brandon Lira
Browse files

Issue #2776661: Clarify docs for setRebuild() and isRebuilding() usage in processForm()

parent 66206ec4
No related branches found
No related tags found
1 merge request!9319FormBuild docs
......@@ -602,16 +602,17 @@ public function processForm($form_id, &$form, FormStateInterface &$form_state) {
return;
}
// If $form_state->isRebuilding() returns TRUE and input has been processed
// without validation errors, we are in a multi-step workflow that is not yet
// complete. In this scenario, a new $form must be constructed based on the
// changes made to $form_state during this request.
// If $form_state->setRebuild(TRUE) was called and input has been
// processed without validation errors, we are in a multi-step workflow
// that is not yet complete. A new $form needs to be constructed based
// on the changes made to $form_state during this request.
//
// Typically, a submit handler calls $form_state->setRebuild(TRUE) when a fully
// executed form requires another step. However, for forms that have not been
// fully executed (e.g., Ajax submissions triggered by non-buttons), there is
// no submit handler to invoke setRebuild(). In that case, we also rebuild
// error-free, non-executed forms, regardless of $form_state->isRebuilding().
// Typically, a submit handler calls $form_state->setRebuild(TRUE) when
// a fully executed form requires another step. However, for forms that
// have not been fully executed (e.g., AJAX submissions triggered by
// non-buttons), there is no submit handler to call setRebuild(). In
// that case, we also rebuild error-free, non-executed forms, regardless
// of $form_state->isRebuilding().
// @todo Simplify this logic; considering Ajax and non-HTML front-ends,
// along with element-level #submit properties, it makes no sense to
// have divergent form execution based on whether the triggering element
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment