public function LingotekConfigTranslationService::checkSourceStatus in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 8 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkSourceStatus()
- 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkSourceStatus()
- 4.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkSourceStatus()
- 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkSourceStatus()
- 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkSourceStatus()
- 3.2.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkSourceStatus()
- 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkSourceStatus()
- 3.4.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkSourceStatus()
- 3.5.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkSourceStatus()
- 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkSourceStatus()
- 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::checkSourceStatus()
Checks the source is uploaded correctly.
Parameters
\Drupal\Core\Config\Entity\ConfigEntityInterface $entity: The entity which status we want to check.
Return value
bool True if the entity is uploaded succesfully.
Overrides LingotekConfigTranslationServiceInterface::checkSourceStatus
File
- src/
LingotekConfigTranslationService.php, line 433
Class
- LingotekConfigTranslationService
- Service for managing Lingotek configuration translations.
Namespace
Drupal\lingotekCode
public function checkSourceStatus(ConfigEntityInterface &$entity) {
$profile = $this->lingotekConfiguration
->getConfigEntityProfile($entity);
if ($profile
->id() === Lingotek::PROFILE_DISABLED || $this
->getSourceStatus($entity) === Lingotek::STATUS_CANCELLED) {
return FALSE;
}
$document_id = $this
->getDocumentId($entity);
if ($document_id) {
try {
$status = $this->lingotek
->getDocumentStatus($document_id);
} catch (LingotekDocumentLockedException $exception) {
$this
->setDocumentId($entity, $exception
->getNewDocumentId());
throw $exception;
} catch (LingotekDocumentNotFoundException $exception) {
if ($this
->checkUploadProcessId($entity)) {
// If the document was not found and the process completed means that
// the document might have been deleted afterwards.
// We check for timeout to set an error if needed.
$this
->setDocumentId($entity, NULL);
$this
->deleteMetadata($entity);
throw $exception;
}
else {
return FALSE;
}
} catch (LingotekDocumentArchivedException $exception) {
$this
->setDocumentId($entity, NULL);
$this
->deleteMetadata($entity);
throw $exception;
} catch (LingotekPaymentRequiredException $exception) {
throw $exception;
} catch (LingotekApiException $exception) {
throw $exception;
}
if ($status) {
$this
->setSourceStatus($entity, Lingotek::STATUS_CURRENT);
return TRUE;
}
}
if ($this
->getSourceStatus($entity) == Lingotek::STATUS_DISABLED) {
$this
->setTargetStatuses($entity, Lingotek::STATUS_DISABLED);
}
return FALSE;
}