Skip to content

Commit 1f05da2

Browse files
authored
ENGCOM-3797: [Forwardport] Using Media Image custom attribute type could not display on frontend. #19054 #20096
2 parents 6bbc346 + 53ad82c commit 1f05da2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/code/Magento/Eav/Model/Entity/Attribute.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
namespace Magento\Eav\Model\Entity;
87

98
use Magento\Framework\Api\AttributeValueFactory;
@@ -295,6 +294,12 @@ public function beforeSave()
295294
}
296295
}
297296

297+
if ($this->getFrontendInput() == 'media_image') {
298+
if (!$this->getFrontendModel()) {
299+
$this->setFrontendModel(\Magento\Catalog\Model\Product\Attribute\Frontend\Image::class);
300+
}
301+
}
302+
298303
if ($this->getBackendType() == 'gallery') {
299304
if (!$this->getBackendModel()) {
300305
$this->setBackendModel(\Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend::class);
@@ -316,7 +321,7 @@ public function afterSave()
316321
}
317322

318323
/**
319-
* @return $this
324+
* @inheritdoc
320325
* @since 100.0.7
321326
*/
322327
public function afterDelete()

0 commit comments

Comments
 (0)