You are here

protected function LingotekContentTranslationService::clearTargetStatuses in Lingotek Translation 3.0.x

Same name and namespace in other branches
  1. 8.2 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
  2. 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
  3. 3.1.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
  4. 3.2.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
  5. 3.3.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
  6. 3.4.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
  7. 3.5.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
  8. 3.6.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
  9. 3.7.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()
  10. 3.8.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::clearTargetStatuses()

Clear the target statuses.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity:

1 call to LingotekContentTranslationService::clearTargetStatuses()
LingotekContentTranslationService::checkTargetStatuses in src/LingotekContentTranslationService.php
Gets the current status of all the target translations.

File

src/LingotekContentTranslationService.php, line 196

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

protected function clearTargetStatuses(ContentEntityInterface &$entity) {
  $profile = $this->lingotekConfiguration
    ->getEntityProfile($entity);
  if ($profile
    ->id() === Lingotek::PROFILE_DISABLED || $this
    ->getSourceStatus($entity) === Lingotek::STATUS_CANCELLED) {
    return FALSE;
  }

  // Clear the target statuses. As we save the source status with the target,
  // we need to keep that one.
  $source_status = $this
    ->getSourceStatus($entity);
  $metadata =& $entity->lingotek_metadata->entity;
  if ($metadata
    ->hasField('translation_status') && count($metadata->translation_status) > 0) {
    $metadata->translation_status = NULL;
  }
  $this
    ->setTargetStatus($entity, $entity
    ->getUntranslated()
    ->language()
    ->getId(), $source_status);
}