function batch_example_finished in Examples for Developers 6
Same name and namespace in other branches
- 8 batch_example/batch_example.module \batch_example_finished()
- 7 batch_example/batch_example.module \batch_example_finished()
- 3.x modules/batch_example/batch_example.module \batch_example_finished()
Batch 'finished' callback used by both batch 1 and batch 2
Related topics
2 string references to 'batch_example_finished'
- batch_example_batch_1 in batch_example/
batch_example.module - Batch 1 : Load 100 times the node with the lowest nid
- batch_example_batch_2 in batch_example/
batch_example.module - Batch 2 : load all nodes 5 by 5, 20 times (Multipart operation)
File
- batch_example/
batch_example.module, line 284 - This is an example outlining how a module can define batches.
Code
function batch_example_finished($success, $results, $operations) {
if ($success) {
// Here we could do something meaningful with the results.
// We just display the number of nodes we processed...
$message = count($results) . ' processed.';
}
else {
// An error occurred.
// $operations contains the operations that remained unprocessed.
$error_operation = reset($operations);
$message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
}
drupal_set_message($message);
}