8.5.x form.inc _batch_populate_queue(&$batch, $set_id)
8.0.x form.inc _batch_populate_queue(&$batch, $set_id)
8.1.x form.inc _batch_populate_queue(&$batch, $set_id)
8.2.x form.inc _batch_populate_queue(&$batch, $set_id)
8.3.x form.inc _batch_populate_queue(&$batch, $set_id)
8.4.x form.inc _batch_populate_queue(&$batch, $set_id)
8.6.x form.inc _batch_populate_queue(&$batch, $set_id)
7.x form.inc _batch_populate_queue(&$batch, $set_id)

Populates a job queue with the operations of a batch set.

Depending on whether the batch is progressive or not, the BatchQueue or BatchMemoryQueue handler classes will be used.

Parameters

$batch: The batch array.

$set_id: The id of the set to process.

Return value

The name and class of the queue are added by reference to the batch set.

Related topics

1 call to _batch_populate_queue()
batch_process in includes/form.inc
Processes the batch.

File

includes/form.inc, line 4749
Functions for form and batch generation and processing.

Code

function _batch_populate_queue(&$batch, $set_id) {
  $batch_set =& $batch['sets'][$set_id];
  if (isset($batch_set['operations'])) {
    $batch_set += array(
      'queue' => array(
        'name' => 'drupal_batch:' . $batch['id'] . ':' . $set_id,
        'class' => $batch['progressive'] ? 'BatchQueue' : 'BatchMemoryQueue',
      ),
    );
    $queue = _batch_queue($batch_set);
    $queue
      ->createQueue();
    foreach ($batch_set['operations'] as $operation) {
      $queue
        ->createItem($operation);
    }
    unset($batch_set['operations']);
  }
}