function BatchTestCallbacks::nestedBatchCallback

Implements callback_batch_operation().

Performs a batch operation setting up its own batch(es).

File

core/modules/system/tests/modules/batch_test/src/BatchTestCallbacks.php, line 167

Class

BatchTestCallbacks
Batch callbacks for testing batches.

Namespace

Drupal\batch_test

Code

public function nestedBatchCallback(array $batches = []) : void {
    $batch_test_definitions = new BatchTestDefinitions();
    $batch_test_helper = new BatchTestHelper();
    foreach ($batches as $batch) {
        $batch_test_helper->stack("setting up batch {$batch}");
        $function = 'batch' . $batch;
        batch_set($batch_test_definitions->{$function}());
    }
    \Drupal::state()->set('batch_test_nested_order_multiple_batches', batch_get());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.