public static function Utility::runBatch in Helper 8
Runs a batch even if another batch is currently running.
This is useful for running a batch inside another batch process.
Parameters
array $batch: A batch array that would normally get passed to batch_set().
File
- src/
Utility.php, line 50
Class
- Utility
- Provides various utility helpers.
Namespace
Drupal\helperCode
public static function runBatch(array $batch) {
$existing_batch = batch_get();
$current_batch =& batch_get();
if ($existing_batch) {
$current_batch = NULL;
}
batch_set($batch);
$current_batch['progressive'] = FALSE;
batch_process();
if ($existing_batch) {
$current_batch = $existing_batch;
}
}