function batch_finished_page
Search API
7.x batch.module | batch_finished_page($batch_id) |
6.x batch.module | batch_finished_page($batch_id) |
5.x batch.module | batch_finished_page($batch_id) |
We redirect to this page when we have finished a batch.
Parameters
unknown_type $batch_id:
File
- modules/
batch/ batch.module, line 151
Code
function batch_finished_page($batch_id) {
$batch = batch_get($batch_id);
if ($batch ["token"] != batch_get_token()) {
return "<p>" . t("Sorry, there is a token mismatch or this batch no longer exists.") . "</p>";
}
// Otherwise, we can just return whatever their callback function is. If this is from a form submission, we will send them
// to the form's original destination.
if (isset($batch ["file"]) && $batch ["file"] != "") {
require_once ($batch ["file"]);
}
$finished_callback = $batch ["finished_callback"][0];
$finished_args = $batch ["finished_callback"][1];
if (!is_array($finished_args)) {
$finished_args = array();
}
$params = array();
// If we are NOT going to fp_goto, then add the $batch as the first argument.
if ($finished_callback != "fp_goto") {
// Add our $batch to the beginning of the $args array.
//array_unshift($finished_args, $batch);
$params = array(0 => &$batch);
}
foreach ($finished_args as $val) {
$params [] = $val;
}
if (isset($batch ["success_message"])) {
fp_add_message($batch ["success_message"]);
}
// Okay, let's call our function:
return call_user_func_array($finished_callback, $params);
}