Пример #1
0
 /**
  * Fires a batch process without a form submission and a finish redirect.
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|null
  *   A redirect response if the batch is progressive. No return value otherwise.
  */
 public function testFinishRedirect()
 {
     batch_test_stack(NULL, TRUE);
     $batch = _batch_test_batch_1();
     $batch['finished'] = '_batch_test_finished_1_finished';
     batch_set($batch);
     return batch_process('batch-test/redirect');
 }
Пример #2
0
 /**
  * Form submission handler #1 for batch_test_chained_form
  */
 public static function batchTestChainedFormSubmit1($form, FormStateInterface $form_state)
 {
     batch_test_stack(NULL, TRUE);
     batch_test_stack('submit handler 1');
     batch_test_stack('value = ' . $form_state['values']['value']);
     $form_state['values']['value']++;
     batch_set(_batch_test_batch_1());
     $form_state->setRedirect('batch_test.redirect');
 }
Пример #3
0
 /**
  * Form submission handler #1 for batch_test_chained_form
  */
 public static function batchTestChainedFormSubmit1($form, &$form_state)
 {
     batch_test_stack(NULL, TRUE);
     batch_test_stack('submit handler 1');
     batch_test_stack('value = ' . $form_state['values']['value']);
     $form_state['values']['value']++;
     batch_set(_batch_test_batch_1());
     $form_state['redirect_route'] = new Url('batch_test.redirect');
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     batch_test_stack(NULL, TRUE);
     switch ($form_state['storage']['step']) {
         case 1:
             batch_set(_batch_test_batch_1());
             break;
         case 2:
             batch_set(_batch_test_batch_2());
             break;
     }
     if ($form_state['storage']['step'] < 2) {
         $form_state['storage']['step']++;
         $form_state['rebuild'] = TRUE;
     }
     $form_state->setRedirect('batch_test.redirect');
 }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 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');
 }
Пример #6
0
 /**
  * Fires a batch process without a form submission.
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|null
  *   A redirect response if the batch is progressive. No return value otherwise.
  */
 public function testNoForm()
 {
     batch_test_stack(NULL, TRUE);
     batch_set(_batch_test_batch_1());
     return batch_process('batch-test/redirect');
 }