You are here

public function LingotekContentTranslationService::setSourceStatus in Lingotek Translation 8

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

Sets the translation status of a given entity.

Parameters

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

int $status: Status of the translation. Use Lingotek class constants.

Return value

ContentEntityInterface

Overrides LingotekContentTranslationServiceInterface::setSourceStatus

6 calls to LingotekContentTranslationService::setSourceStatus()
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::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.
LingotekContentTranslationService::updateDocument in src/LingotekContentTranslationService.php
Resends a document to the translation service.

... See full list

File

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

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

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