public function LingotekEntityController::checkUpload in Lingotek Translation 3.0.x
Same name and namespace in other branches
- 8 src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::checkUpload()
- 8.2 src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::checkUpload()
- 4.0.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::checkUpload()
- 3.1.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::checkUpload()
- 3.2.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::checkUpload()
- 3.3.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::checkUpload()
- 3.4.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::checkUpload()
- 3.5.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::checkUpload()
- 3.6.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::checkUpload()
- 3.7.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::checkUpload()
- 3.8.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::checkUpload()
1 string reference to 'LingotekEntityController::checkUpload'
File
- src/
Controller/ LingotekEntityController.php, line 19
Class
Namespace
Drupal\lingotek\ControllerCode
public function checkUpload($doc_id) {
/** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $translation_service */
$translation_service = \Drupal::service('lingotek.content_translation');
$entity = $translation_service
->loadByDocumentId($doc_id);
if (!$entity) {
// TODO: log warning
return $this
->translationsPageRedirect($entity);
}
try {
if ($translation_service
->checkSourceStatus($entity)) {
$this
->messenger()
->addStatus(t('The import for @entity_type %title is complete.', [
'@entity_type' => $entity
->getEntityTypeId(),
'%title' => $entity
->label(),
]));
}
else {
$this
->messenger()
->addStatus(t('The import for @entity_type %title is still pending.', [
'@entity_type' => $entity
->getEntityTypeId(),
'%title' => $entity
->label(),
]));
}
} catch (LingotekApiException $exception) {
$this
->messenger()
->addError(t('The check for @entity_type status failed. Please try again.', [
'@entity_type' => $entity
->getEntityTypeId(),
'%title' => $entity
->label(),
]));
}
return $this
->translationsPageRedirect($entity);
}