Basically batch is used for performing bulk action/operation on content. Here $itemchuncks has all the nodes and array_chunk is dividing it in to 20 sets of nodes, so that batch can take less time to execute.
$itemchucks = array_chunk($items, 10);
foreach ($itemchucks as $key => $item) {
$operations[] = array('function_name_which_will_perform_logic', array($item));
}
$batch = array(
'title' => t('Update fields'),
'operations' => $operations,
'init_message' => t('Updating'),
'finished' => 'function_to_display_finished_message_of_batch',
);
batch_set($batch);
Comments
Post a Comment