Skip to content

Commit c809a71

Browse files
committed
MAGETWO-55814: East team cadenece 3 PR
- FAT tests fix and duplication of code removing
1 parent a94a5ed commit c809a71

File tree

5 files changed

+33
-342
lines changed

5 files changed

+33
-342
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ class Validate extends \Magento\Catalog\Controller\Adminhtml\Product\Attribute
2222
*/
2323
protected $layoutFactory;
2424

25+
/**
26+
* @var array
27+
*/
28+
private $multipleAttributeList;
29+
2530
/**
2631
* Constructor
2732
*
@@ -31,18 +36,21 @@ class Validate extends \Magento\Catalog\Controller\Adminhtml\Product\Attribute
3136
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
3237
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
3338
* @param \Magento\Framework\View\LayoutFactory $layoutFactory
39+
* @param array $multipleAttributeList
3440
*/
3541
public function __construct(
3642
\Magento\Backend\App\Action\Context $context,
3743
\Magento\Framework\Cache\FrontendInterface $attributeLabelCache,
3844
\Magento\Framework\Registry $coreRegistry,
3945
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
4046
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
41-
\Magento\Framework\View\LayoutFactory $layoutFactory
47+
\Magento\Framework\View\LayoutFactory $layoutFactory,
48+
array $multipleAttributeList = []
4249
) {
4350
parent::__construct($context, $attributeLabelCache, $coreRegistry, $resultPageFactory);
4451
$this->resultJsonFactory = $resultJsonFactory;
4552
$this->layoutFactory = $layoutFactory;
53+
$this->multipleAttributeList = $multipleAttributeList;
4654
}
4755

4856
/**
@@ -90,7 +98,15 @@ public function execute()
9098
}
9199
}
92100

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+
}
94110

95111
return $this->resultJsonFactory->create()->setJsonData($response->toJson());
96112
}

app/code/Magento/Catalog/etc/adminhtml/di.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@
4747
</argument>
4848
</arguments>
4949
</type>
50+
<type name="Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate">
51+
<arguments>
52+
<argument name="multipleAttributeList" xsi:type="array">
53+
<item name="select" xsi:type="string">option</item>
54+
</argument>
55+
</arguments>
56+
</type>
5057
<type name="Magento\Catalog\Model\Product\Copier">
5158
<arguments>
5259
<argument name="copyConstructor" xsi:type="object">Magento\Catalog\Model\Product\CopyConstructor\Composite</argument>

app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Validate.php

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)