function ContentTranslationMetadataWrapper::setFieldOnlyIfTranslatable
Same name in other branches
- 9 core/modules/content_translation/src/ContentTranslationMetadataWrapper.php \Drupal\content_translation\ContentTranslationMetadataWrapper::setFieldOnlyIfTranslatable()
- 8.9.x core/modules/content_translation/src/ContentTranslationMetadataWrapper.php \Drupal\content_translation\ContentTranslationMetadataWrapper::setFieldOnlyIfTranslatable()
- 10 core/modules/content_translation/src/ContentTranslationMetadataWrapper.php \Drupal\content_translation\ContentTranslationMetadataWrapper::setFieldOnlyIfTranslatable()
Updates a field value, only if the field is translatable.
Parameters
string $field_name: The name of the field.
mixed $value: The field value to be set.
4 calls to ContentTranslationMetadataWrapper::setFieldOnlyIfTranslatable()
- ContentTranslationMetadataWrapper::setAuthor in core/
modules/ content_translation/ src/ ContentTranslationMetadataWrapper.php - Sets the translation author.
- ContentTranslationMetadataWrapper::setChangedTime in core/
modules/ content_translation/ src/ ContentTranslationMetadataWrapper.php - Sets the translation modification timestamp.
- ContentTranslationMetadataWrapper::setCreatedTime in core/
modules/ content_translation/ src/ ContentTranslationMetadataWrapper.php - Sets the translation creation timestamp.
- ContentTranslationMetadataWrapper::setPublished in core/
modules/ content_translation/ src/ ContentTranslationMetadataWrapper.php - Sets the translation published status.
File
-
core/
modules/ content_translation/ src/ ContentTranslationMetadataWrapper.php, line 144
Class
- ContentTranslationMetadataWrapper
- Base class for content translation metadata wrappers.
Namespace
Drupal\content_translationCode
protected function setFieldOnlyIfTranslatable($field_name, $value) {
if ($this->translation
->getFieldDefinition($field_name)
->isTranslatable()) {
$this->translation
->set($field_name, $value);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.