function batch_start_batch_from_form_submit
Search API
7.x batch.module | batch_start_batch_from_form_submit($batch_id, $redirect_path = "", $redirect_query = "") |
6.x batch.module | batch_start_batch_from_form_submit($batch_id, $redirect_path = "", $redirect_query = "") |
5.x batch.module | batch_start_batch_from_form_submit($batch_id, $redirect_path = "", $redirect_query = "") |
A batch process is being initiated from a form submission.
Parameters
unknown_type $batch_id:
1 call to batch_start_batch_from_form_submit()
- system_handle_form_submit in modules/
system/ system.module - Intercepts form submissions from forms built with the form API.
File
- modules/
batch/ batch.module, line 395
Code
function batch_start_batch_from_form_submit($batch_id, $redirect_path = "", $redirect_query = "") {
// We need to confirm that this user is allowed to access THIS batch.
$current_user_token = batch_get_token();
$batch = batch_get($batch_id);
if ($batch ["token"] == $current_user_token) {
// Yes, we can proceed!
// If there isn't a finished_callback set, we will set it using fp_goto() to return to the original form's redirect path and query.
if (!isset($batch ["finished_callback"])) {
$batch ["finished_callback"] = array("fp_goto", array($redirect_path, $redirect_query));
// Update the database...
db_query("UPDATE batch_queue
SET batch_data = '?'
WHERE batch_id = '?'", serialize($batch), $batch_id);
}
// Let's fp_goto to our batch-processing page...
fp_goto("batch-processing/$batch_id");
}
else {
// No... some problem.
fp_add_message(t("Sorry, this batch process could not be initialized. Bad token, or batch does not exist?"), "error");
return;
}
}