batch_example_batch_2

Definition

batch_example_batch_2()
developer/examples/batch_example.module, line 186

Description

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

Related topics

Namesort iconDescription
Example batch definitionsDefinitions of the batches used in this module.

Code

<?php
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 1 has encountered an error.'),
  );
  return $batch;
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.