@@ -71,6 +71,16 @@ class Grouped extends AbstractModifier
7171 */
7272 protected $ localeCurrency ;
7373
74+ /**
75+ * @var array
76+ */
77+ protected $ uiComponentsConfig = [
78+ 'button_set ' => 'grouped_products_button_set ' ,
79+ 'modal ' => 'grouped_products_modal ' ,
80+ 'listing ' => 'grouped_product_listing ' ,
81+ 'form ' => 'product_form ' ,
82+ ];
83+
7484 /**
7585 * @var string
7686 */
@@ -95,6 +105,7 @@ class Grouped extends AbstractModifier
95105 * @param Status $status
96106 * @param AttributeSetRepositoryInterface $attributeSetRepository
97107 * @param CurrencyInterface $localeCurrency
108+ * @param array $uiComponentsConfig
98109 */
99110 public function __construct (
100111 LocatorInterface $ locator ,
@@ -104,7 +115,8 @@ public function __construct(
104115 ImageHelper $ imageHelper ,
105116 Status $ status ,
106117 AttributeSetRepositoryInterface $ attributeSetRepository ,
107- CurrencyInterface $ localeCurrency
118+ CurrencyInterface $ localeCurrency ,
119+ array $ uiComponentsConfig = []
108120 ) {
109121 $ this ->locator = $ locator ;
110122 $ this ->urlBuilder = $ urlBuilder ;
@@ -114,6 +126,7 @@ public function __construct(
114126 $ this ->attributeSetRepository = $ attributeSetRepository ;
115127 $ this ->status = $ status ;
116128 $ this ->localeCurrency = $ localeCurrency ;
129+ $ this ->uiComponentsConfig = array_replace_recursive ($ this ->uiComponentsConfig , $ uiComponentsConfig );
117130 }
118131
119132 /**
@@ -246,8 +259,8 @@ protected function modifyQtyAndStockStatus(array $meta)
246259 protected function getChildren ()
247260 {
248261 $ children = [
249- ' grouped_products_button_set ' => $ this ->getButtonSet (),
250- ' grouped_products_modal ' => $ this ->getModal (),
262+ $ this -> uiComponentsConfig [ ' button_set ' ] => $ this ->getButtonSet (),
263+ $ this -> uiComponentsConfig [ ' modal ' ] => $ this ->getModal (),
251264 self ::LINK_TYPE => $ this ->getGrid (),
252265 ];
253266 return $ children ;
@@ -266,7 +279,11 @@ protected function getModal()
266279 'config ' => [
267280 'componentType ' => Modal::NAME ,
268281 'dataScope ' => '' ,
269- 'provider ' => 'product_form.product_form_data_source ' ,
282+ 'provider ' =>
283+ $ this ->uiComponentsConfig ['form ' ]
284+ . '. '
285+ . $ this ->uiComponentsConfig ['form ' ]
286+ . '_data_source ' ,
270287 'options ' => [
271288 'title ' => __ ('Add Products to Group ' ),
272289 'buttons ' => [
@@ -280,7 +297,7 @@ protected function getModal()
280297 'class ' => 'action-primary ' ,
281298 'actions ' => [
282299 [
283- 'targetName ' => 'index = grouped_product_listing ' ,
300+ 'targetName ' => 'index = ' . $ this -> uiComponentsConfig [ ' listing ' ] ,
284301 'actionName ' => 'save '
285302 ],
286303 'closeModal '
@@ -291,7 +308,7 @@ protected function getModal()
291308 ],
292309 ],
293310 ],
294- 'children ' => [' grouped_product_listing ' => $ this ->getListing ()],
311+ 'children ' => [$ this -> uiComponentsConfig [ ' listing ' ] => $ this ->getListing ()],
295312 ];
296313 }
297314
@@ -308,13 +325,25 @@ protected function getListing()
308325 'config ' => [
309326 'autoRender ' => false ,
310327 'componentType ' => 'insertListing ' ,
311- 'dataScope ' => 'grouped_product_listing ' ,
312- 'externalProvider ' => 'grouped_product_listing.grouped_product_listing_data_source ' ,
313- 'selectionsProvider ' => 'grouped_product_listing.grouped_product_listing.product_columns.ids ' ,
314- 'ns ' => 'grouped_product_listing ' ,
328+ 'dataScope ' => $ this ->uiComponentsConfig ['listing ' ],
329+ 'externalProvider ' =>
330+ $ this ->uiComponentsConfig ['listing ' ]
331+ . '. '
332+ . $ this ->uiComponentsConfig ['listing ' ]
333+ . '_data_source ' ,
334+ 'selectionsProvider ' =>
335+ $ this ->uiComponentsConfig ['listing ' ]
336+ . '. '
337+ . $ this ->uiComponentsConfig ['listing ' ]
338+ . '.product_columns.ids ' ,
339+ 'ns ' => $ this ->uiComponentsConfig ['listing ' ],
315340 'render_url ' => $ this ->urlBuilder ->getUrl ('mui/index/render ' ),
316341 'realTimeLink ' => true ,
317- 'provider ' => 'product_form.product_form_data_source ' ,
342+ 'provider ' =>
343+ $ this ->uiComponentsConfig ['form ' ]
344+ . '. '
345+ . $ this ->uiComponentsConfig ['form ' ]
346+ . '_data_source ' ,
318347 'dataLinks ' => ['imports ' => false , 'exports ' => true ],
319348 'behaviourType ' => 'simple ' ,
320349 'externalFilterMode ' => true ,
@@ -365,16 +394,22 @@ protected function getButtonSet()
365394 'actions ' => [
366395 [
367396 'targetName ' =>
368- 'product_form.product_form. '
397+ $ this ->uiComponentsConfig ['form ' ] . '. ' . $ this ->uiComponentsConfig ['form ' ]
398+ . '. '
369399 . static ::GROUP_GROUPED
370- . '.grouped_products_modal ' ,
400+ . '. '
401+ . $ this ->uiComponentsConfig ['modal ' ],
371402 'actionName ' => 'openModal ' ,
372403 ],
373404 [
374405 'targetName ' =>
375- 'product_form.product_form. '
406+ $ this ->uiComponentsConfig ['form ' ] . '. ' . $ this ->uiComponentsConfig ['form ' ]
407+ . '. '
376408 . static ::GROUP_GROUPED
377- . '.grouped_products_modal.grouped_product_listing ' ,
409+ . '. '
410+ . $ this ->uiComponentsConfig ['modal ' ]
411+ . '. '
412+ . $ this ->uiComponentsConfig ['listing ' ],
378413 'actionName ' => 'render ' ,
379414 ],
380415 ],
@@ -409,7 +444,7 @@ protected function getGrid()
409444 'itemTemplate ' => 'record ' ,
410445 'dataScope ' => 'data.links ' ,
411446 'deleteButtonLabel ' => __ ('Remove ' ),
412- 'dataProvider ' => ' grouped_product_listing ' ,
447+ 'dataProvider ' => $ this -> uiComponentsConfig [ ' listing ' ] ,
413448 'map ' => [
414449 'id ' => 'entity_id ' ,
415450 'name ' => 'name ' ,
0 commit comments