You are here

public function EntityChangedTrait::getChangedTimeAcrossTranslations in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/EntityChangedTrait.php \Drupal\Core\Entity\EntityChangedTrait::getChangedTimeAcrossTranslations()

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

Return value

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

File

core/lib/Drupal/Core/Entity/EntityChangedTrait.php, line 22
Contains \Drupal\Core\Entity\EntityChangedTrait.

Class

EntityChangedTrait
Provides a trait for accessing changed time.

Namespace

Drupal\Core\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;
}