You are here

public function LingotekContentTranslationService::setSourceStatus in Lingotek Translation 3.3.x

Same name and namespace in other branches
  1. 8 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
  2. 8.2 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
  3. 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
  4. 3.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
  5. 3.1.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
  6. 3.2.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

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

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

Return value

\Drupal\Core\Entity\ContentEntityInterface

Overrides LingotekContentTranslationServiceInterface::setSourceStatus

8 calls to LingotekContentTranslationService::setSourceStatus()
LingotekContentTranslationService::addTarget in src/LingotekContentTranslationService.php
Request a translation for a given entity in the given locale.
LingotekContentTranslationService::cancelDocument in src/LingotekContentTranslationService.php
Cancels a document from the server.
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::downloadDocuments in src/LingotekContentTranslationService.php
Downloads a document from the Lingotek service for all available locales.

... See full list

File

src/LingotekContentTranslationService.php, line 189

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

public function setSourceStatus(ContentEntityInterface &$entity, $status) {
  $metadata = $entity->lingotek_metadata->entity;
  $source_language = $metadata->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);
}