if ($form_state->
isProcessingInput()) { // Form values for programmed form submissions typically do not include a
// value for the submit button. But without a triggering element, a
// potentially existing #limit_validation_errors property on the primary
// submit button is not taken account. Therefore, check whether there is
// exactly one submit button in the form, and if so, automatically use it
// as triggering_element.
$buttons =
$form_state->
getButtons();
if ($form_state->
isProgrammed() && !
$form_state->
getTriggeringElement() &&
count($buttons) == 1
) { $form_state->
setTriggeringElement(reset($buttons));
} $this->formValidator->
validateForm($form_id,
$form,
$form_state);
// If there are no errors and the form is not rebuilding, submit the form.
if (!
$form_state->
isRebuilding() && !FormState::
hasAnyErrors()) { $submit_response =
$this->formSubmitter->
doSubmitForm($form,
$form_state);
// If this form was cached, delete it from the cache after submission.
if ($form_state->
isCached()) { $this->
deleteCache($form['#build_id'
]);
} // If the form submission directly returned a response, return it now.
if ($submit_response) { return $submit_response;
}