_batch_test_batch_2 example


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

}


  /** * Form submission handler #2 for batch_test_chained_form. */
  public static function batchTestChainedFormSubmit2($form, FormStateInterface $form_state) {
    batch_test_stack('submit handler 2');
    batch_test_stack('value = ' . $form_state->getValue('value'));

    $value = &$form_state->getValue('value');
    $value++;
    batch_set(_batch_test_batch_2());

    $form_state->setRedirect('batch_test.redirect');
  }

  /** * Form submission handler #3 for batch_test_chained_form. */
  public static function batchTestChainedFormSubmit3($form, FormStateInterface $form_state) {
    batch_test_stack('submit handler 3');
    batch_test_stack('value = ' . $form_state->getValue('value'));

    
Home | Imprint | This part of the site doesn't use cookies.