public function LingotekContentTranslationService::setSourceStatus in Lingotek Translation 3.5.x
Same name and namespace in other branches
- 8 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
 - 8.2 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
 - 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
 - 3.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
 - 3.1.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
 - 3.2.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
 - 3.3.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
 - 3.4.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
 - 3.6.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
 - 3.7.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::setSourceStatus()
 - 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
9 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::checkForTimeout in src/
LingotekContentTranslationService.php  - Checks the time elapsed since the last upload and sets the entity to error if the max time has elapsed.
 - 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.
 
File
- src/
LingotekContentTranslationService.php, line 202  
Class
- LingotekContentTranslationService
 - Service for managing Lingotek content translations.
 
Namespace
Drupal\lingotekCode
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);
}