function batch_example_op_1
Same name in other branches
- 7.x-1.x batch_example/batch_example.module \batch_example_op_1()
- 4.0.x modules/batch_example/batch_example.module \batch_example_op_1()
Batch operation for batch 1: one at a time.
This is the function that is called on each operation in batch 1.
Related topics
1 string reference to 'batch_example_op_1'
- BatchExampleForm::generateBatch1 in modules/
batch_example/ src/ Form/ BatchExampleForm.php - Generate Batch 1.
File
-
modules/
batch_example/ batch_example.module, line 36
Code
function batch_example_op_1($id, $operation_details, &$context) {
// Simulate long process by waiting 1/50th of a second.
usleep(20000);
// Store some results for post-processing in the 'finished' callback.
// The contents of 'results' will be available as $results in the
// 'finished' function (in this example, batch_example_finished()).
$context['results'][] = $id;
// Optional message displayed under the progressbar.
$context['message'] = t('Running Batch "@id" @details', [
'@id' => $id,
'@details' => $operation_details,
]);
}