function batch_example_batch_2

Same name in other branches
  1. 7.x-1.x batch_example/batch_example.module \batch_example_batch_2()

Batch 2 : load all nodes 5 by 5, 20 times (Multipart operation)

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

1 call to batch_example_batch_2()
batch_example_multistep_form_submit in batch_example/batch_example.module

File

batch_example/batch_example.module, line 214

Code

function batch_example_batch_2() {
    $operations = array();
    for ($i = 0; $i < 20; $i++) {
        $operations[] = array(
            'batch_example_op_2',
            array(),
        );
    }
    $batch = array(
        'operations' => $operations,
        'finished' => 'batch_example_finished',
        // We can define custom messages instead of the default ones.
'title' => t('Processing batch 2'),
        'init_message' => t('Batch 2 is starting.'),
        'progress_message' => t('Processed @current out of @total.'),
        'error_message' => t('Batch 2 has encountered an error.'),
    );
    return $batch;
}