function _batch_populate_queue
Same name in other branches
- 7.x includes/form.inc \_batch_populate_queue()
- 8.9.x core/includes/form.inc \_batch_populate_queue()
- 10 core/includes/form.inc \_batch_populate_queue()
- 11.x core/includes/form.inc \_batch_populate_queue()
Populates a job queue with the operations of a batch set.
Depending on whether the batch is progressive or not, the Drupal\Core\Queue\Batch or Drupal\Core\Queue\BatchMemory handler classes will be used. The name and class of the queue are added by reference to the batch set.
Parameters
$batch: The batch array.
$set_id: The id of the set to process.
Related topics
2 calls to _batch_populate_queue()
- batch_process in core/
includes/ form.inc - Processes the batch.
- _batch_append_set in core/
includes/ form.inc - Appends a batch set to a running batch.
File
-
core/
includes/ form.inc, line 987
Code
function _batch_populate_queue(&$batch, $set_id) {
$batch_set =& $batch['sets'][$set_id];
if (isset($batch_set['operations'])) {
$batch_set += [
'queue' => [
'name' => 'drupal_batch:' . $batch['id'] . ':' . $set_id,
'class' => $batch['progressive'] ? 'Drupal\\Core\\Queue\\Batch' : 'Drupal\\Core\\Queue\\BatchMemory',
],
];
$queue = _batch_queue($batch_set);
$queue->createQueue();
foreach ($batch_set['operations'] as $operation) {
$queue->createItem($operation);
}
unset($batch_set['operations']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.