Same name and namespace in other branches
- 8.9.x core/lib/Drupal/Core/Form/FormBuilder.php \Drupal\Core\Form\FormBuilder::submitForm()
- 9 core/lib/Drupal/Core/Form/FormBuilder.php \Drupal\Core\Form\FormBuilder::submitForm()
File
- core/
lib/ Drupal/ Core/ Form/ FormBuilder.php, line 476
Class
- FormBuilder
- Provides form building and processing.
Namespace
Drupal\Core\FormCode
public function submitForm($form_arg, FormStateInterface &$form_state) {
$build_info = $form_state
->getBuildInfo();
if (empty($build_info['args'])) {
$args = func_get_args();
// Remove $form and $form_state from the arguments.
unset($args[0], $args[1]);
$form_state
->addBuildInfo('args', array_values($args));
}
// Populate FormState::$input with the submitted values before retrieving
// the form, to be consistent with what self::buildForm() does for
// non-programmatic submissions (form builder functions may expect it to be
// there).
$form_state
->setUserInput($form_state
->getValues());
$form_state
->setProgrammed();
$form_id = $this
->getFormId($form_arg, $form_state);
$form = $this
->retrieveForm($form_id, $form_state);
// Programmed forms are always submitted.
$form_state
->setSubmitted();
// Reset form validation.
$form_state
->setValidationEnforced();
$form_state
->clearErrors();
$this
->prepareForm($form_id, $form, $form_state);
$this
->processForm($form_id, $form, $form_state);
}