function batch_example_batch_1 in Examples for Developers 6
Same name and namespace in other branches
- 7 batch_example/batch_example.module \batch_example_batch_1()
Batch 1 : Load 100 times the node with the lowest nid
This method does not yet do the work; it simply builds an array of the work which needs to be done during the batch processing. The results of this function will be passed to the batch processor for actual processing.
Related topics
2 calls to batch_example_batch_1()
- batch_example_multistep_form_submit in batch_example/
batch_example.module - batch_example_page in batch_example/
batch_example.module
File
- batch_example/
batch_example.module, line 176 - This is an example outlining how a module can define batches.
Code
function batch_example_batch_1() {
$nid = db_result(db_query_range("SELECT nid FROM {node} ORDER BY nid ASC", 0, 1));
$operations = array();
for ($i = 0; $i < 100; $i++) {
$operations[] = array(
'batch_example_op_1',
array(
$nid,
),
);
}
// Create an array which contains an array of the operations to
// perform and a method to call when the operations are all finished
$batch = array(
'operations' => $operations,
'finished' => 'batch_example_finished',
);
return $batch;
}