function BatchBuilder::addOperation

Same name in other branches
  1. 9 core/lib/Drupal/Core/Batch/BatchBuilder.php \Drupal\Core\Batch\BatchBuilder::addOperation()
  2. 10 core/lib/Drupal/Core/Batch/BatchBuilder.php \Drupal\Core\Batch\BatchBuilder::addOperation()
  3. 11.x core/lib/Drupal/Core/Batch/BatchBuilder.php \Drupal\Core\Batch\BatchBuilder::addOperation()

Adds a batch operation.

Parameters

callable $callback: The name of the callback function.

array $arguments: An array of arguments to pass to the callback function.

Return value

$this

File

core/lib/Drupal/Core/Batch/BatchBuilder.php, line 314

Class

BatchBuilder
Builds an array for a batch process.

Namespace

Drupal\Core\Batch

Code

public function addOperation(callable $callback, array $arguments = []) {
    $this->operations[] = [
        $callback,
        $arguments,
    ];
    return $this;
}

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