You are here

public function LingotekContentTranslationService::getTargetStatuses in Lingotek Translation 3.7.x

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

Gets the translation statuses of a given entity translation for all locales.

Parameters

\Drupal\Core\Entity\ContentEntityInterface &$entity: The entity which status we want to get.

Return value

array The statuses of the target translation keyed by langcode (see Lingotek class constants for the values)

Overrides LingotekContentTranslationServiceInterface::getTargetStatuses

1 call to LingotekContentTranslationService::getTargetStatuses()
LingotekContentTranslationService::getTargetStatus in src/LingotekContentTranslationService.php
Gets the translation status of a given entity translation for a locale.

File

src/LingotekContentTranslationService.php, line 441

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

public function getTargetStatuses(ContentEntityInterface &$entity) {
  $statuses = [];
  $metadata = $entity->lingotek_metadata ? $entity->lingotek_metadata->entity : NULL;
  if ($metadata !== NULL && count($metadata->translation_status) > 0) {
    foreach ($metadata->translation_status
      ->getIterator() as $delta => $value) {
      $statuses[$value->language] = $value->value;
    }
  }
  return $statuses;
}