public function LingotekConfigTranslationService::hasEntityChanged in Lingotek Translation 3.4.x
Same name and namespace in other branches
- 8 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::hasEntityChanged()
- 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::hasEntityChanged()
- 4.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::hasEntityChanged()
- 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::hasEntityChanged()
- 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::hasEntityChanged()
- 3.2.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::hasEntityChanged()
- 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::hasEntityChanged()
- 3.5.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::hasEntityChanged()
- 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::hasEntityChanged()
- 3.7.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::hasEntityChanged()
- 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::hasEntityChanged()
Checks if the source entity data has changed from last time we uploaded it.
Parameters
\Drupal\Core\Config\ConfigEntityInterface &$entity: The entity being checked
Return value
bool TRUE if the entity has changed, false if not.
Overrides LingotekConfigTranslationServiceInterface::hasEntityChanged
File
- src/
LingotekConfigTranslationService.php, line 281
Class
- LingotekConfigTranslationService
- Service for managing Lingotek configuration translations.
Namespace
Drupal\lingotekCode
public function hasEntityChanged(ConfigEntityInterface &$entity) {
$source_data = json_encode($this
->getSourceData($entity));
$hash = md5($source_data);
$metadata = LingotekConfigMetadata::loadByConfigName($entity
->getEntityTypeId() . '.' . $entity
->id());
$old_hash = $metadata
->getHash();
if (!$old_hash || strcmp($hash, $old_hash)) {
$metadata
->setHash($hash)
->save();
return TRUE;
}
return FALSE;
}