You are here

public function LingotekContentTranslationService::cancelDocument in Lingotek Translation 3.6.x

Same name and namespace in other branches
  1. 8.2 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::cancelDocument()
  2. 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::cancelDocument()
  3. 3.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::cancelDocument()
  4. 3.1.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::cancelDocument()
  5. 3.2.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::cancelDocument()
  6. 3.3.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::cancelDocument()
  7. 3.4.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::cancelDocument()
  8. 3.5.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::cancelDocument()
  9. 3.7.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::cancelDocument()
  10. 3.8.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::cancelDocument()

Cancels a document from the server.

Parameters

\Drupal\Core\Entity\ContentEntityInterface &$entity: The entity which we want to cancel.

Return value

\Drupal\Core\Entity\ContentEntityInterface The entity.

Overrides LingotekContentTranslationServiceInterface::cancelDocument

1 call to LingotekContentTranslationService::cancelDocument()
LingotekContentTranslationService::deleteMetadata in src/LingotekContentTranslationService.php
Deletes all local metadata related to an entity.

File

src/LingotekContentTranslationService.php, line 1450

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

public function cancelDocument(ContentEntityInterface &$entity) {
  $result = FALSE;
  $doc_id = $this
    ->getDocumentId($entity);
  if ($doc_id) {
    $result = $this->lingotek
      ->cancelDocument($doc_id);
    $this->lingotekConfiguration
      ->setProfile($entity, NULL);
    $this
      ->setDocumentId($entity, NULL);
  }
  $this
    ->setSourceStatus($entity, Lingotek::STATUS_CANCELLED);
  $this
    ->setTargetStatuses($entity, Lingotek::STATUS_CANCELLED);
  return $result;
}