@@ -22,6 +22,11 @@ class Validate extends \Magento\Catalog\Controller\Adminhtml\Product\Attribute
22
22
*/
23
23
protected $ layoutFactory ;
24
24
25
+ /**
26
+ * @var array
27
+ */
28
+ private $ multipleAttributeList ;
29
+
25
30
/**
26
31
* Constructor
27
32
*
@@ -31,18 +36,21 @@ class Validate extends \Magento\Catalog\Controller\Adminhtml\Product\Attribute
31
36
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
32
37
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
33
38
* @param \Magento\Framework\View\LayoutFactory $layoutFactory
39
+ * @param array $multipleAttributeList
34
40
*/
35
41
public function __construct (
36
42
\Magento \Backend \App \Action \Context $ context ,
37
43
\Magento \Framework \Cache \FrontendInterface $ attributeLabelCache ,
38
44
\Magento \Framework \Registry $ coreRegistry ,
39
45
\Magento \Framework \View \Result \PageFactory $ resultPageFactory ,
40
46
\Magento \Framework \Controller \Result \JsonFactory $ resultJsonFactory ,
41
- \Magento \Framework \View \LayoutFactory $ layoutFactory
47
+ \Magento \Framework \View \LayoutFactory $ layoutFactory ,
48
+ array $ multipleAttributeList = []
42
49
) {
43
50
parent ::__construct ($ context , $ attributeLabelCache , $ coreRegistry , $ resultPageFactory );
44
51
$ this ->resultJsonFactory = $ resultJsonFactory ;
45
52
$ this ->layoutFactory = $ layoutFactory ;
53
+ $ this ->multipleAttributeList = $ multipleAttributeList ;
46
54
}
47
55
48
56
/**
@@ -90,7 +98,15 @@ public function execute()
90
98
}
91
99
}
92
100
93
- $ this ->checkUniqueOption ($ response , $ this ->getRequest ()->getParam ("option " ));
101
+ $ multipleOption = $ this ->getRequest ()->getParam ("frontend_input " );
102
+ $ multipleOption = is_null ($ multipleOption ) ? 'select ' : $ multipleOption ;
103
+
104
+ if (isset ($ this ->multipleAttributeList [$ multipleOption ]) && !is_null ($ multipleOption )) {
105
+ $ this ->checkUniqueOption (
106
+ $ response ,
107
+ $ this ->getRequest ()->getParam ($ this ->multipleAttributeList [$ multipleOption ])
108
+ );
109
+ }
94
110
95
111
return $ this ->resultJsonFactory ->create ()->setJsonData ($ response ->toJson ());
96
112
}
0 commit comments