public function LingotekContentTranslationService::deleteMetadata in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::deleteMetadata()
- 4.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::deleteMetadata()
- 3.0.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::deleteMetadata()
- 3.1.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::deleteMetadata()
- 3.2.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::deleteMetadata()
- 3.3.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::deleteMetadata()
- 3.4.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::deleteMetadata()
- 3.5.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::deleteMetadata()
- 3.6.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::deleteMetadata()
- 3.7.x src/LingotekContentTranslationService.php \Drupal\lingotek\LingotekContentTranslationService::deleteMetadata()
- 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
ContentEntityInterface The entity.
Overrides LingotekContentTranslationServiceInterface::deleteMetadata
File
- src/
LingotekContentTranslationService.php, line 740 - Contains \Drupal\lingotek\LingotekContentTranslationService.
Class
- LingotekContentTranslationService
- Service for managing Lingotek content translations.
Namespace
Drupal\lingotekCode
public function deleteMetadata(ContentEntityInterface &$entity) {
if ($this->lingotekConfiguration
->mustDeleteRemoteAfterDisassociation()) {
$this
->deleteDocument($entity);
}
$doc_id = $this
->getDocumentId($entity);
$entity->lingotek_translation_status = NULL;
$entity->lingotek_document_id = NULL;
\Drupal::database()
->delete('lingotek_content_metadata')
->condition('document_id', $doc_id)
->condition('entity_type', $entity
->getEntityTypeId())
->condition('entity_id', $entity
->id())
->execute();
// If the entity supports revisions, ensure we don't create a new one.
if ($entity
->getEntityType()
->hasKey('revision')) {
$entity
->setNewRevision(FALSE);
}
$entity->lingotek_processed = TRUE;
$entity
->save();
}