ContentTranslationMetadataWrapper::setFieldOnlyIfTranslatable

protected ContentTranslationMetadataWrapper::setFieldOnlyIfTranslatable($field_name, $value)

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.

File

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

Class

ContentTranslationMetadataWrapper
Base class for content translation metadata wrappers.

Namespace

Drupal\content_translation

Code

protected function setFieldOnlyIfTranslatable($field_name, $value) {
  if ($this->translation->getFieldDefinition($field_name)->isTranslatable()) {
    $this->translation->set($field_name, $value);
  }
}
doc_Drupal
2016-10-29 08:58:25
Comments
Leave a Comment

Please login to continue.