You are here

public function ContentTranslationMetadataWrapper::setChangedTime in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_translation/src/ContentTranslationMetadataWrapper.php \Drupal\content_translation\ContentTranslationMetadataWrapper::setChangedTime()

Sets the translation modification timestamp.

The metadata field will be updated, only if it's translatable.

Parameters

int $timestamp: The UNIX timestamp of when the translation was last modified.

Return value

$this

Overrides ContentTranslationMetadataWrapperInterface::setChangedTime

File

core/modules/content_translation/src/ContentTranslationMetadataWrapper.php, line 130

Class

ContentTranslationMetadataWrapper
Base class for content translation metadata wrappers.

Namespace

Drupal\content_translation

Code

public function setChangedTime($timestamp) {
  $field_name = $this->translation
    ->hasField('content_translation_changed') ? 'content_translation_changed' : 'changed';
  $this
    ->setFieldOnlyIfTranslatable($field_name, $timestamp);
  return $this;
}