function ContentTranslationMetadataWrapper::setAuthor

Same name in other branches
  1. 9 core/modules/content_translation/src/ContentTranslationMetadataWrapper.php \Drupal\content_translation\ContentTranslationMetadataWrapper::setAuthor()
  2. 8.9.x core/modules/content_translation/src/ContentTranslationMetadataWrapper.php \Drupal\content_translation\ContentTranslationMetadataWrapper::setAuthor()
  3. 10 core/modules/content_translation/src/ContentTranslationMetadataWrapper.php \Drupal\content_translation\ContentTranslationMetadataWrapper::setAuthor()

Overrides ContentTranslationMetadataWrapperInterface::setAuthor

File

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

Class

ContentTranslationMetadataWrapper
Base class for content translation metadata wrappers.

Namespace

Drupal\content_translation

Code

public function setAuthor(UserInterface $account) {
    $field_name = $this->translation
        ->hasField('content_translation_uid') ? 'content_translation_uid' : 'uid';
    $this->setFieldOnlyIfTranslatable($field_name, $account->id());
    return $this;
}

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