You are here

public function Job::abortTranslation in Translation Management Tool 8

Attempts to abort the translation job.

Already accepted jobs can not be aborted, submitted jobs only if supported by the translator plugin. Always use this method if you want to abort a translation job.

Return value

bool TRUE if the translation job was aborted, FALSE otherwise.

Overrides JobInterface::abortTranslation

File

src/Entity/Job.php, line 781

Class

Job
Entity class for the tmgmt_job entity.

Namespace

Drupal\tmgmt\Entity

Code

public function abortTranslation() {
  if (!$this
    ->isAbortable() || !($plugin = $this
    ->getTranslatorPlugin())) {
    return FALSE;
  }

  // We don't know if the translator plugin was able to abort the translation
  // job after this point. That means that the plugin has to set the
  // 'aborted' state on its own.
  return $plugin
    ->abortTranslation($this);
}