10
10
use Cloudinary \Cloudinary \Model \ProductGalleryApiQueueFactory ;
11
11
use Cloudinary \Cloudinary \Model \ProductImageFinder ;
12
12
use Cloudinary \Cloudinary \Model \TransformationFactory ;
13
+ use Cloudinary \Cloudinary \Helper \ProductGalleryHelper ;
13
14
use Magento \Catalog \Api \ProductRepositoryInterface ;
14
15
use Magento \Catalog \Model \Product \Gallery \Processor ;
15
16
use Magento \Catalog \Model \Product \Media \Config as ProductMediaConfig ;
@@ -161,6 +162,8 @@ class ProductGalleryManagement implements \Cloudinary\Cloudinary\Api\ProductGall
161
162
*/
162
163
private $ resourceConnection ;
163
164
165
+ private $ productGalleryHelper ;
166
+
164
167
/**
165
168
* @method __construct
166
169
* @param ConfigurationInterface $configuration
@@ -208,7 +211,8 @@ public function __construct(
208
211
MediaLibraryMapFactory $ mediaLibraryMapFactory ,
209
212
ProductGalleryApiQueueFactory $ productGalleryApiQueueFactory ,
210
213
AppEmulation $ appEmulation ,
211
- ResourceConnection $ resourceConnection
214
+ ResourceConnection $ resourceConnection ,
215
+ ProductGalleryHelper $ productGalleryHelper
212
216
) {
213
217
$ this ->configuration = $ configuration ;
214
218
$ this ->request = $ request ;
@@ -232,6 +236,7 @@ public function __construct(
232
236
$ this ->productGalleryApiQueueFactory = $ productGalleryApiQueueFactory ;
233
237
$ this ->appEmulation = $ appEmulation ;
234
238
$ this ->resourceConnection = $ resourceConnection ;
239
+ $ this ->productGalleryHelper = $ productGalleryHelper ;
235
240
}
236
241
237
242
@@ -405,6 +410,7 @@ private function _getProductMedia($sku)
405
410
}
406
411
407
412
return $ this ->jsonHelper ->jsonEncode ($ result );
413
+
408
414
}
409
415
410
416
/**
@@ -828,6 +834,7 @@ private function getProductCldUrlsBySku($sku)
828
834
'small_image ' => null ,
829
835
'thumbnail ' => null ,
830
836
'media_gallery ' => [],
837
+ 'gallery_widget_parameters ' => [],
831
838
];
832
839
try {
833
840
$ product = $ this ->productRepository ->get ($ sku );
@@ -843,6 +850,7 @@ private function getProductCldUrlsBySku($sku)
843
850
$ urls ['thumbnail ' ] = $ gallItem ->getUrl ();
844
851
}
845
852
}
853
+ $ urls ['gallery_widget_parameters ' ] = $ this ->jsonHelper ->jsonEncode ($ this ->productGalleryHelper ->getCloudinaryPGOptions ());
846
854
} catch (\Exception $ e ) {
847
855
$ urls = [
848
856
'error ' => 1 ,
0 commit comments