You are here

public function LingotekConfigTranslationService::markTranslationsAsDirty in Lingotek Translation 3.1.x

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

Marks the translation status as dirty if they exist.

Parameters

\Drupal\Core\Config\ConfigEntityInterface &$entity: The entity which status we want to change.

Return value

\Drupal\Core\Config\ConfigEntityInterface

Overrides LingotekConfigTranslationServiceInterface::markTranslationsAsDirty

File

src/LingotekConfigTranslationService.php, line 297

Class

LingotekConfigTranslationService
Service for managing Lingotek configuration translations.

Namespace

Drupal\lingotek

Code

public function markTranslationsAsDirty(ConfigEntityInterface &$entity) {
  $target_languages = $this->languageManager
    ->getLanguages();
  $entity_langcode = $entity
    ->language()
    ->getId();

  // Only mark as out of date the current ones.
  $to_change = [
    Lingotek::STATUS_CURRENT,
  ];
  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_PENDING);
      }
    }
  }
}