Issue #3294883 by marcoscano: Fix inaccurate code comment in Media.php

merge-requests/2501/head
catch 2022-07-09 21:18:54 +09:00
parent 0586c53169
commit 69f148f64e
1 changed files with 2 additions and 2 deletions

View File

@ -375,8 +375,8 @@ class Media extends EditorialContentEntityBase implements MediaInterface {
// Try to set fields provided by the media source and mapped in
// media type config.
foreach ($translation->bundle->entity->getFieldMap() as $metadata_attribute_name => $entity_field_name) {
// Only save value in entity field if empty. Do not overwrite existing
// data.
// Only save value in the entity if the field is empty or if the
// source field changed.
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));
}