function BatchTestMultiStepForm::submitForm

Same name in other branches
  1. 9 core/modules/system/tests/modules/batch_test/src/Form/BatchTestMultiStepForm.php \Drupal\batch_test\Form\BatchTestMultiStepForm::submitForm()
  2. 8.9.x core/modules/system/tests/modules/batch_test/src/Form/BatchTestMultiStepForm.php \Drupal\batch_test\Form\BatchTestMultiStepForm::submitForm()
  3. 11.x core/modules/system/tests/modules/batch_test/src/Form/BatchTestMultiStepForm.php \Drupal\batch_test\Form\BatchTestMultiStepForm::submitForm()

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\Form

Code

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');
}

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