function EntityChangedTrait::getChangedTimeAcrossTranslations

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityChangedTrait.php \Drupal\Core\Entity\EntityChangedTrait::getChangedTimeAcrossTranslations()
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityChangedTrait.php \Drupal\Core\Entity\EntityChangedTrait::getChangedTimeAcrossTranslations()
  3. 11.x 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 17

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.