1010use Cloudinary \Cloudinary \Model \ProductGalleryApiQueueFactory ;
1111use Cloudinary \Cloudinary \Model \ProductImageFinder ;
1212use Cloudinary \Cloudinary \Model \TransformationFactory ;
13+ use Cloudinary \Cloudinary \Helper \ProductGalleryHelper ;
1314use Magento \Catalog \Api \ProductRepositoryInterface ;
1415use Magento \Catalog \Model \Product \Gallery \Processor ;
1516use Magento \Catalog \Model \Product \Media \Config as ProductMediaConfig ;
@@ -161,6 +162,8 @@ class ProductGalleryManagement implements \Cloudinary\Cloudinary\Api\ProductGall
161162 */
162163 private $ resourceConnection ;
163164
165+ private $ productGalleryHelper ;
166+
164167 /**
165168 * @method __construct
166169 * @param ConfigurationInterface $configuration
@@ -208,7 +211,8 @@ public function __construct(
208211 MediaLibraryMapFactory $ mediaLibraryMapFactory ,
209212 ProductGalleryApiQueueFactory $ productGalleryApiQueueFactory ,
210213 AppEmulation $ appEmulation ,
211- ResourceConnection $ resourceConnection
214+ ResourceConnection $ resourceConnection ,
215+ ProductGalleryHelper $ productGalleryHelper
212216 ) {
213217 $ this ->configuration = $ configuration ;
214218 $ this ->request = $ request ;
@@ -232,6 +236,7 @@ public function __construct(
232236 $ this ->productGalleryApiQueueFactory = $ productGalleryApiQueueFactory ;
233237 $ this ->appEmulation = $ appEmulation ;
234238 $ this ->resourceConnection = $ resourceConnection ;
239+ $ this ->productGalleryHelper = $ productGalleryHelper ;
235240 }
236241
237242
@@ -405,6 +410,7 @@ private function _getProductMedia($sku)
405410 }
406411
407412 return $ this ->jsonHelper ->jsonEncode ($ result );
413+
408414 }
409415
410416 /**
@@ -828,6 +834,7 @@ private function getProductCldUrlsBySku($sku)
828834 'small_image ' => null ,
829835 'thumbnail ' => null ,
830836 'media_gallery ' => [],
837+ 'gallery_widget_parameters ' => [],
831838 ];
832839 try {
833840 $ product = $ this ->productRepository ->get ($ sku );
@@ -843,6 +850,7 @@ private function getProductCldUrlsBySku($sku)
843850 $ urls ['thumbnail ' ] = $ gallItem ->getUrl ();
844851 }
845852 }
853+ $ urls ['gallery_widget_parameters ' ] = $ this ->jsonHelper ->jsonEncode ($ this ->productGalleryHelper ->getCloudinaryPGOptions ());
846854 } catch (\Exception $ e ) {
847855 $ urls = [
848856 'error ' => 1 ,
0 commit comments