You are here

public function JobQueue::startQueue in Translation Management Tool 8

Initializes the queue with a set of jobs, resets the queue.

Parameters

\Drupal\tmgmt\JobInterface[] $jobs: Job jobs to be added.

string $destination: (optional) A destination to redirect to after the queue is finished.

File

src/JobQueue.php, line 68

Class

JobQueue
Represents a job (checkout) queue.

Namespace

Drupal\tmgmt

Code

public function startQueue(array $jobs, $destination = NULL) {
  $this
    ->resetQueue();
  foreach ($jobs as $job) {
    if (!$this
      ->isJobInQueue($job)) {
      $this->queue[] = $job
        ->id();
    }
  }
  $this
    ->setDestination($destination);
}