function batch_test_form_submit

7.x batch.test.inc batch_test_form_submit($form, $form_state)
6.x batch.test.inc batch_test_form_submit($form, $form_state)
5.x batch.test.inc batch_test_form_submit($form, $form_state)

File

modules/batch/batch.test.inc, line 77
This file contains functionality for testing out Batch's processing with a sample form which performs some arbitrary actions.

Code

function batch_test_form_submit($form, $form_state) {

  $items_max = $form_state ["values"]["items"];
  $destination = $form_state ["values"]["destination"];

  // Okay, set up the batch....
  $batch = array(
    "operation" => array("batch_test_perform_batch_operation", array($items_max)),
    "title" => t("Test Batch Operation"),
    "success_message" => t("The batch operation completed successfully."),
    "display_percent" => $form_state ["values"]["display_percent"],
    "file" => menu_get_module_path("batch") . "/batch.test.inc",
  );

  // If we should decide to go to a function (and override the default form behavior) then let's record that here.
  if ($destination == "function") {
    $batch ["finished_callback"] = array("batch_test_finished_page", array($items_max));
  }



  // Set the batch...
  batch_set($batch);

  // Since this is being called from within a form_submit, there is nothing left for us to do.  The batch will be automatically called
  // once the submission process is executed. 

}