You are here

protected function LingotekConfigTranslationService::clearTargetStatuses in Lingotek Translation 3.2.x

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

Clear the target statuses.

Parameters

\Drupal\Core\Config\Entity\ConfigEntityInterface $entity:

1 call to LingotekConfigTranslationService::clearTargetStatuses()
LingotekConfigTranslationService::checkTargetStatuses in src/LingotekConfigTranslationService.php
Checks the status of all the translations in the Lingotek service.

File

src/LingotekConfigTranslationService.php, line 676

Class

LingotekConfigTranslationService
Service for managing Lingotek configuration translations.

Namespace

Drupal\lingotek

Code

protected function clearTargetStatuses(ConfigEntityInterface &$entity) {
  $profile = $this->lingotekConfiguration
    ->getConfigEntityProfile($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 = LingotekConfigMetadata::loadByConfigName($entity
    ->getEntityTypeId() . '.' . $entity
    ->id());
  $metadata
    ->setTargetStatus([])
    ->save();
}