function BatchBuilder::toArray

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

Converts a \Drupal\Core\Batch\Batch object into an array.

Return value

array The array representation of the object.

File

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

Class

BatchBuilder
Builds an array for a batch process.

Namespace

Drupal\Core\Batch

Code

public function toArray() {
    $array = [
        'operations' => $this->operations ?: [],
        'title' => $this->title ?: '',
        'init_message' => $this->initMessage ?: '',
        'progress_message' => $this->progressMessage ?: '',
        'error_message' => $this->errorMessage ?: '',
        'finished' => $this->finished,
        'file' => $this->file,
        'library' => $this->libraries ?: [],
        'url_options' => $this->urlOptions ?: [],
        'progressive' => $this->progressive,
    ];
    if ($this->queue) {
        $array['queue'] = $this->queue;
    }
    return $array;
}

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