You are here

public function BatchBuilder::toArray in Drupal 8

Same name and namespace in other branches
  1. 9 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;
}