You are here

public function LingotekContentTranslationService::updateEntityHash in Lingotek Translation 3.8.x

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

Updates the entity hash.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity being checked

Return value

$this

Overrides LingotekContentTranslationServiceInterface::updateEntityHash

File

src/LingotekContentTranslationService.php, line 1064

Class

LingotekContentTranslationService
Service for managing Lingotek content translations.

Namespace

Drupal\lingotek

Code

public function updateEntityHash(ContentEntityInterface $entity) {
  $source_data = json_encode($this
    ->getSourceData($entity));
  if ($entity->lingotek_metadata->entity) {
    $entity->lingotek_metadata->entity->lingotek_hash = md5($source_data);
    $entity->lingotek_metadata->entity
      ->save();
  }
}