Skip to content

Commit 68974e9

Browse files
committed
Merge remote-tracking branch 'origin/ACP2E-3880' into PR_2025_05_16
2 parents 13caa39 + d8971cc commit 68974e9

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Product/CollectionProcessor/MediaGalleryProcessor.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2019 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -51,7 +51,9 @@ public function process(
5151
array $attributeNames,
5252
?ContextInterface $context = null
5353
): Collection {
54-
if (in_array('media_gallery_entries', $attributeNames)) {
54+
if (in_array('media_gallery_entries', $attributeNames) ||
55+
in_array('media_gallery', $attributeNames)
56+
) {
5557
$mediaAttributes = $this->mediaConfig->getMediaAttributeCodes();
5658
foreach ($mediaAttributes as $mediaAttribute) {
5759
if (!in_array($mediaAttribute, $attributeNames)) {

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ interface MediaGalleryInterface @doc(description: "Contains basic information ab
229229
label: String @doc(description: "The label of the product image or video.")
230230
position: Int @doc(description: "The media item's position after it has been sorted.")
231231
disabled: Boolean @doc(description: "Indicates whether the image is hidden from view.")
232+
types: [String] @doc(description: "Array of image types. It can have the following values: image, small_image, thumbnail.")
232233
}
233234

234235
type ProductImage implements MediaGalleryInterface @doc(description: "Contains product image information, including the image URL and label.") {

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/MediaGalleryTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2018 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -119,6 +119,7 @@ public function testMediaGallery()
119119
url
120120
position
121121
disabled
122+
types
122123
}
123124
}
124125
}
@@ -136,6 +137,10 @@ public function testMediaGallery()
136137
$this->assertEquals(2, $mediaGallery[1]['position']);
137138
$this->assertFalse($mediaGallery[1]['disabled']);
138139
$this->assertTrue($this->checkImageExists($mediaGallery[1]['url']));
140+
$this->assertNotEmpty($mediaGallery[0]['types']);
141+
$this->assertEquals('image', $mediaGallery[0]['types'][0]);
142+
$this->assertNotEmpty($mediaGallery[1]['types']);
143+
$this->assertEquals('thumbnail', $mediaGallery[1]['types'][0]);
139144
}
140145

141146
/**
@@ -155,6 +160,7 @@ public function testMediaGalleryForProductVideos()
155160
label
156161
url
157162
position
163+
types
158164
disabled
159165
... on ProductVideo {
160166
video_content {
@@ -179,6 +185,8 @@ public function testMediaGalleryForProductVideos()
179185
$this->assertTrue($this->checkImageExists($mediaGallery[0]['url']));
180186
$this->assertFalse($mediaGallery[0]['disabled']);
181187
$this->assertEquals(2, $mediaGallery[0]['position']);
188+
$this->assertNotEmpty($mediaGallery[0]['types']);
189+
$this->assertEquals('image', $mediaGallery[0]['types'][0]);
182190
$this->assertNotEmpty($mediaGallery[0]['video_content']);
183191
$video_content = $mediaGallery[0]['video_content'];
184192
$this->assertEquals('external-video', $video_content['media_type']);

0 commit comments

Comments
 (0)