You are here

public function Job::aborted in Translation Management Tool 8

Sets the state of the job to 'aborted'.

Parameters

string $message: The log message to be saved along with the state change.

array $variables: (Optional) An array of variables to replace in the message on display.

string $type: Statically set to status.

Use Job::abortTranslation() to abort a translation.

Return value

\Drupal\tmgmt\JobInterface The job entity.

Overrides JobInterface::aborted

See also

Job::addMessage()

File

src/Entity/Job.php, line 704

Class

Job
Entity class for the tmgmt_job entity.

Namespace

Drupal\tmgmt\Entity

Code

public function aborted($message = NULL, $variables = array(), $type = 'status') {
  if (!isset($message)) {
    $message = 'The translation job has been aborted.';
  }

  /** @var \Drupal\tmgmt\JobItemInterface $item */
  foreach ($this
    ->getItems() as $item) {
    $item
      ->setState(JobItem::STATE_ABORTED);
  }
  return $this
    ->setState(static::STATE_ABORTED, $message, $variables, $type);
}