You are here

public function LingotekContentTranslationService::getTargetStatus in Lingotek Translation 8

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

Gets the translation status of a given entity translation for a locale.

Parameters

ContentEntityInterface &$entity: The entity which status we want to get.

string $locale: Lingotek translation language which we want to get.

Return value

int The status of the target translation (see Lingotek class constants)

Overrides LingotekContentTranslationServiceInterface::getTargetStatus

7 calls to LingotekContentTranslationService::getTargetStatus()
LingotekContentTranslationService::addTarget in src/LingotekContentTranslationService.php
Request a translation for a given entity in the given locale.
LingotekContentTranslationService::checkTargetStatus in src/LingotekContentTranslationService.php
Gets the current status of the target translation.
LingotekContentTranslationService::checkTargetStatuses in src/LingotekContentTranslationService.php
Gets the current status of all the target translations.
LingotekContentTranslationService::getSourceStatus in src/LingotekContentTranslationService.php
Gets the source status of the given entity.
LingotekContentTranslationService::markTranslationsAsDirty in src/LingotekContentTranslationService.php
Marks the translation status as dirty if they exist.

... See full list

File

src/LingotekContentTranslationService.php, line 226
Contains \Drupal\lingotek\LingotekContentTranslationService.

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

public function getTargetStatus(ContentEntityInterface &$entity, $langcode) {
  $status = Lingotek::STATUS_UNTRACKED;
  if (count($entity->lingotek_translation_status) > 0) {
    foreach ($entity->lingotek_translation_status
      ->getIterator() as $delta => $value) {
      if ($value->language == $langcode) {
        $status = $value->value;
      }
    }
  }
  return $status;
}