Issue #3294883 by marcoscano: Fix inaccurate code comment in Media.php
parent
0586c53169
commit
69f148f64e
|
@ -375,8 +375,8 @@ class Media extends EditorialContentEntityBase implements MediaInterface {
|
||||||
// Try to set fields provided by the media source and mapped in
|
// Try to set fields provided by the media source and mapped in
|
||||||
// media type config.
|
// media type config.
|
||||||
foreach ($translation->bundle->entity->getFieldMap() as $metadata_attribute_name => $entity_field_name) {
|
foreach ($translation->bundle->entity->getFieldMap() as $metadata_attribute_name => $entity_field_name) {
|
||||||
// Only save value in entity field if empty. Do not overwrite existing
|
// Only save value in the entity if the field is empty or if the
|
||||||
// data.
|
// source field changed.
|
||||||
if ($translation->hasField($entity_field_name) && ($translation->get($entity_field_name)->isEmpty() || $translation->hasSourceFieldChanged())) {
|
if ($translation->hasField($entity_field_name) && ($translation->get($entity_field_name)->isEmpty() || $translation->hasSourceFieldChanged())) {
|
||||||
$translation->set($entity_field_name, $media_source->getMetadata($translation, $metadata_attribute_name));
|
$translation->set($entity_field_name, $media_source->getMetadata($translation, $metadata_attribute_name));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue