public function LingotekConfigTranslationService::cancelConfigDocument in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocument()
- 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocument()
- 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocument()
- 3.2.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocument()
- 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocument()
- 3.4.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocument()
- 3.5.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocument()
- 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocument()
- 3.7.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocument()
- 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocument()
Cancels a document from the server.
Parameters
string $mapper_id: The entity being cancelled.
Throws
\Drupal\lingotek\Exception\LingotekDocumentNotFoundException
Overrides LingotekConfigTranslationServiceInterface::cancelConfigDocument
1 call to LingotekConfigTranslationService::cancelConfigDocument()
- LingotekConfigTranslationService::deleteConfigMetadata in src/
LingotekConfigTranslationService.php - Deletes metadata.
File
- src/
LingotekConfigTranslationService.php, line 1594
Class
- LingotekConfigTranslationService
- Service for managing Lingotek configuration translations.
Namespace
Drupal\lingotekCode
public function cancelConfigDocument($mapper_id) {
$mapper = $this->mappers[$mapper_id];
$result = FALSE;
$doc_id = $this
->getConfigDocumentId($mapper);
if ($doc_id) {
try {
$result = $this->lingotek
->cancelDocument($doc_id);
} catch (LingotekDocumentAlreadyCompletedException $exception) {
\Drupal::logger('lingotek')
->warning('The document %label (%doc_id) was not cancelled on the TMS side as it was already completed.', [
'%label' => $mapper
->getTitle(),
'%doc_id' => $doc_id,
]);
} catch (LingotekDocumentNotFoundException $exception) {
$this
->setConfigDocumentId($mapper, NULL);
$this
->deleteConfigMetadata($mapper_id);
throw $exception;
} catch (LingotekDocumentArchivedException $exception) {
$this
->messenger()
->addError($this
->t('Document %label has been archived. Please upload again.', [
'%label' => $mapper
->getTitle(),
]));
}
$this
->setConfigDocumentId($mapper, NULL);
}
$this
->setConfigSourceStatus($mapper, Lingotek::STATUS_CANCELLED);
$this
->setConfigTargetStatuses($mapper, Lingotek::STATUS_CANCELLED);
return $result;
}