You are here

public function LingotekConfigTranslationService::getSourceStatus in Lingotek Translation 8

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

Gets the source status of the given entity.

Parameters

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

Return value

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

Overrides LingotekConfigTranslationServiceInterface::getSourceStatus

4 calls to LingotekConfigTranslationService::getSourceStatus()
LingotekConfigTranslationService::addTarget in src/LingotekConfigTranslationService.php
Request a translation for a given entity in the given locale.
LingotekConfigTranslationService::checkTargetStatus in src/LingotekConfigTranslationService.php
Checks the status of the translation in the Lingotek service.
LingotekConfigTranslationService::downloadDocument in src/LingotekConfigTranslationService.php
Downloads a document from the Lingotek service for a given locale.
LingotekConfigTranslationService::requestTranslations in src/LingotekConfigTranslationService.php
Requests translations of a document in all the enabled locales.

File

src/LingotekConfigTranslationService.php, line 190
Contains \Drupal\lingotek\LingotekConfigTranslationService.

Class

LingotekConfigTranslationService
Service for managing Lingotek configuration translations.

Namespace

Drupal\lingotek

Code

public function getSourceStatus(ConfigEntityInterface &$entity) {
  $status = Lingotek::STATUS_UNTRACKED;
  $metadata = LingotekConfigMetadata::loadByConfigName($entity
    ->getEntityTypeId() . '.' . $entity
    ->id());
  $source_status = $metadata
    ->getSourceStatus();
  if ($source_status !== NULL && isset($source_status[$entity
    ->language()
    ->getId()])) {
    $status = $source_status[$entity
      ->language()
      ->getId()];
  }
  return $status;
}