You are here

public function LingotekContentTranslationService::getSourceStatus in Lingotek Translation 8

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

Gets the source status of the given entity.

Parameters

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

Return value

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

Overrides LingotekContentTranslationServiceInterface::getSourceStatus

5 calls to LingotekContentTranslationService::getSourceStatus()
LingotekContentTranslationService::addTarget in src/LingotekContentTranslationService.php
Request a translation for a given entity in the given locale.
LingotekContentTranslationService::checkSourceStatus in src/LingotekContentTranslationService.php
Checks the source is uploaded correctly.
LingotekContentTranslationService::checkTargetStatus in src/LingotekContentTranslationService.php
Gets the current status of the target translation.
LingotekContentTranslationService::downloadDocument in src/LingotekContentTranslationService.php
Downloads a document from the Lingotek service for a given locale.
LingotekContentTranslationService::requestTranslations in src/LingotekContentTranslationService.php
Requests translations of a document in all the enabled locales.

File

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

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

public function getSourceStatus(ContentEntityInterface &$entity) {
  $source_language = LanguageInterface::LANGCODE_NOT_SPECIFIED;
  if ($entity->lingotek_translation_source && $entity->lingotek_translation_source->value !== NULL) {
    $source_language = $entity->lingotek_translation_source->value;
  }
  if ($source_language == LanguageInterface::LANGCODE_NOT_SPECIFIED) {
    $source_language = $entity
      ->getUntranslated()
      ->language()
      ->getId();
  }
  return $this
    ->getTargetStatus($entity, $source_language);
}