public function BatchTestMultiStepForm::submitForm in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/batch_test/src/Form/BatchTestMultiStepForm.php \Drupal\batch_test\Form\BatchTestMultiStepForm::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- core/
modules/ system/ tests/ modules/ batch_test/ src/ Form/ BatchTestMultiStepForm.php, line 51
Class
- BatchTestMultiStepForm
- Generate form of id batch_test_multistep_form.
Namespace
Drupal\batch_test\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
batch_test_stack(NULL, TRUE);
$step = $form_state
->get('step');
switch ($step) {
case 1:
batch_set(_batch_test_batch_1());
break;
case 2:
batch_set(_batch_test_batch_2());
break;
}
if ($step < 2) {
$form_state
->set('step', ++$step);
$form_state
->setRebuild();
}
$form_state
->setRedirect('batch_test.redirect');
}