Skip to content

Commit 0d191b7

Browse files
committed
Add label param to the image.
1 parent a636914 commit 0d191b7

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductImage.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,17 @@ public function resolve(
6464
/** @var \Magento\Catalog\Helper\Image $catalogImageHelper */
6565
$catalogImageHelper = $this->catalogImageHelperFactory->create();
6666

67-
$imageUrl = $catalogImageHelper->init(
67+
/** @var \Magento\Catalog\Helper\Image $image */
68+
$image = $catalogImageHelper->init(
6869
$product,
6970
'product_' . $imageType,
7071
['type' => $imageType]
71-
)->getUrl();
72+
);
7273

7374
$imageData = [
74-
'url' => $imageUrl,
75-
'path' => $product->getData($imageType)
75+
'url' => $image->getUrl(),
76+
'path' => $product->getData($imageType),
77+
'label' => $image->getLabel()
7678
];
7779

7880
return $imageData;

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,6 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\
264264
new_to_date: String @doc(description: "The end date for new product listings") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\NewFromTo")
265265
tier_price: Float @doc(description: "The price when tier pricing is in effect and the items purchased threshold has been reached")
266266
options_container: String @doc(description: "If the product has multiple options, determines where they appear on the product page")
267-
image_label: String @doc(description: "The label assigned to a product image")
268-
small_image_label: String @doc(description: "The label assigned to a product's small image")
269-
thumbnail_label: String @doc(description: "The label assigned to a product's thumbnail image")
270267
created_at: String @doc(description: "Timestamp indicating when the product was created")
271268
updated_at: String @doc(description: "Timestamp indicating when the product was updated")
272269
country_of_manufacture: String @doc(description: "The product's country of origin")
@@ -352,9 +349,10 @@ type CustomizableFileValue @doc(description: "CustomizableFileValue defines the
352349
image_size_y: Int @doc(description: "The maximum height of an image")
353350
}
354351

355-
type ProductImage @doc(description: "Product image information. Contains image relative path and URL") {
352+
type ProductImage @doc(description: "Product image information. Contains image relative path, URL and label") {
356353
url: String
357354
path: String
355+
label: String
358356
}
359357

360358
interface CustomizableOptionInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\\CustomizableOptionTypeResolver") @doc(description: "The CustomizableOptionInterface contains basic information about a customizable option. It can be implemented by several types of configurable options.") {

0 commit comments

Comments
 (0)