You are here

public function Flipbook::getChangedTimeAcrossTranslations in 3D Flipbook 8

Gets the timestamp of the last entity change across all translations.

This method will return the highest timestamp across all translations. To check that no translation is older than in another version of the entity (e.g. to avoid overwriting newer translations with old data), compare each translation to the other version individually.

Return value

int The timestamp of the last entity save operation across all translations.

Overrides EntityChangedInterface::getChangedTimeAcrossTranslations

File

src/Entity/Flipbook.php, line 169

Class

Flipbook
Defines the Flipbook entity.

Namespace

Drupal\flipbook\Entity

Code

public function getChangedTimeAcrossTranslations() {
  $changed = $this
    ->getUntranslated()
    ->getChangedTime();
  foreach ($this
    ->getTranslationLanguages(FALSE) as $language) {
    $translation_changed = $this
      ->getTranslation($language
      ->getId())
      ->getChangedTime();
    $changed = max($translation_changed, $changed);
  }
  return $changed;
}