public function JobItem::acceptTranslation

Propagates the returned job item translations to the sources.

Return value

bool TRUE if we were able to propagate the translated data and the item could be saved, FALSE otherwise.

Overrides JobItemInterface::acceptTranslation

1 call to JobItem::acceptTranslation()
JobItem::needsReview in src/Entity/JobItem.php
Sets the state of the job item to 'needs review'.

File

src/Entity/JobItem.php, line 886

Class

JobItem
Entity class for the tmgmt_job_item entity.

Namespace

Drupal\tmgmt\Entity

Code

public function acceptTranslation() {
  if (!$this
    ->isNeedsReview() || !($plugin = $this
    ->getSourcePlugin())) {
    return FALSE;
  }
  if (!$plugin
    ->saveTranslation($this, $this
    ->getJob()
    ->getTargetLangcode())) {
    return FALSE;
  }

  // If the plugin could save the translation, we will set it
  // to the 'accepted' state.
  $this
    ->accepted();
  return TRUE;
}