public function LingotekConfigTranslationService::markTranslationsAsDirty in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::markTranslationsAsDirty()
 - 4.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::markTranslationsAsDirty()
 - 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::markTranslationsAsDirty()
 - 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::markTranslationsAsDirty()
 - 3.2.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::markTranslationsAsDirty()
 - 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::markTranslationsAsDirty()
 - 3.4.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::markTranslationsAsDirty()
 - 3.5.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::markTranslationsAsDirty()
 - 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::markTranslationsAsDirty()
 - 3.7.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::markTranslationsAsDirty()
 - 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::markTranslationsAsDirty()
 
Marks the translation status as dirty if they exist.
Parameters
ConfigEntityInterface &$entity: The entity which status we want to change.
Return value
Overrides LingotekConfigTranslationServiceInterface::markTranslationsAsDirty
File
- src/
LingotekConfigTranslationService.php, line 302  - Contains \Drupal\lingotek\LingotekConfigTranslationService.
 
Class
- LingotekConfigTranslationService
 - Service for managing Lingotek configuration translations.
 
Namespace
Drupal\lingotekCode
public function markTranslationsAsDirty(ConfigEntityInterface &$entity) {
  $target_languages = $this->languageManager
    ->getLanguages();
  $entity_langcode = $entity
    ->language()
    ->getId();
  // These statuses indicate that content has been uploaded to the API, so
  // we need to flag them as out of date.
  $to_change = [
    Lingotek::STATUS_CURRENT,
    Lingotek::STATUS_PENDING,
    Lingotek::STATUS_INTERMEDIATE,
    Lingotek::STATUS_READY,
  ];
  foreach ($target_languages as $langcode => $language) {
    if ($langcode != $entity_langcode && ($current_status = $this
      ->getTargetStatus($entity, $langcode))) {
      if (in_array($current_status, $to_change)) {
        $this
          ->setTargetStatus($entity, $langcode, Lingotek::STATUS_EDITED);
      }
    }
  }
}