public function LingotekContentTranslationService::getSourceStatus in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceStatus()
- 8.2 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceStatus()
- 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceStatus()
- 3.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceStatus()
- 3.1.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceStatus()
- 3.3.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceStatus()
- 3.4.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceStatus()
- 3.5.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceStatus()
- 3.6.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceStatus()
- 3.7.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceStatus()
- 3.8.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::getSourceStatus()
Gets the source status of the given entity.
Parameters
\Drupal\Core\Entity\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
12 calls to LingotekContentTranslationService::getSourceStatus()
- LingotekContentTranslationService::addTarget in src/
LingotekContentTranslationService.php - Request a translation for a given entity in the given locale.
- LingotekContentTranslationService::cancelDocumentTarget in src/
LingotekContentTranslationService.php - Cancels 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::checkTargetStatuses in src/
LingotekContentTranslationService.php - Gets the current status of all the target translations.
File
- src/
LingotekContentTranslationService.php, line 168
Class
- LingotekContentTranslationService
- Service for managing Lingotek content translations.
Namespace
Drupal\lingotekCode
public function getSourceStatus(ContentEntityInterface &$entity) {
$source_language = LanguageInterface::LANGCODE_NOT_SPECIFIED;
$metadata = $entity->lingotek_metadata ? $entity->lingotek_metadata->entity : NULL;
if ($metadata !== NULL && $metadata->translation_source && $metadata->translation_source->value !== NULL) {
$source_language = $metadata->translation_source->value;
}
if ($source_language == LanguageInterface::LANGCODE_NOT_SPECIFIED) {
$source_language = $entity
->getUntranslated()
->language()
->getId();
}
return $this
->getTargetStatus($entity, $source_language);
}