You are here

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

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

Deletes all local metadata related to an entity.

Parameters

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

Return value

\Drupal\Core\Entity\ContentEntityInterface The entity.

Overrides LingotekContentTranslationServiceInterface::deleteMetadata

4 calls to LingotekContentTranslationService::deleteMetadata()
LingotekContentTranslationService::addTarget in src/LingotekContentTranslationService.php
Request a translation for a given entity in the given locale.
LingotekContentTranslationService::requestTranslations in src/LingotekContentTranslationService.php
Requests translations of a document in all the enabled locales.
LingotekContentTranslationService::setJobId in src/LingotekContentTranslationService.php
Sets the job ID of a given entity.
LingotekContentTranslationService::updateDocument in src/LingotekContentTranslationService.php
Resends a document to the translation service.

File

src/LingotekContentTranslationService.php, line 1496

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

public function deleteMetadata(ContentEntityInterface &$entity) {
  $doc_id = $this
    ->getDocumentId($entity);
  if ($doc_id) {
    $this
      ->cancelDocument($entity);
  }
  $metadata = $entity->lingotek_metadata->entity;
  if ($metadata !== NULL) {
    $metadata
      ->delete();
  }
}