|
1 | 1 | <?php
|
2 | 2 | /**
|
3 |
| - * Copyright © 2013-2017 Magento, Inc. All rights reserved. |
| 3 | + * Copyright © 2013-2018 Magento, Inc. All rights reserved. |
4 | 4 | * See COPYING.txt for license details.
|
5 | 5 | */
|
6 | 6 | namespace Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab;
|
7 | 7 |
|
8 | 8 | use Magento\Backend\Block\Widget\Form;
|
9 | 9 | use Magento\Backend\Block\Widget\Form\Generic;
|
10 | 10 | use Magento\Ui\Component\Layout\Tabs\TabInterface;
|
| 11 | +use Magento\CatalogRule\Api\Data\RuleInterface; |
| 12 | +use Magento\Rule\Model\Condition\AbstractCondition; |
11 | 13 |
|
12 | 14 | class Conditions extends Generic implements TabInterface
|
13 | 15 | {
|
@@ -134,7 +136,7 @@ protected function _prepareForm()
|
134 | 136 | }
|
135 | 137 |
|
136 | 138 | /**
|
137 |
| - * @param \Magento\CatalogRule\Api\Data\RuleInterface $model |
| 139 | + * @param RuleInterface $model |
138 | 140 | * @param string $fieldsetId
|
139 | 141 | * @param string $formName
|
140 | 142 | * @return \Magento\Framework\Data\Form
|
@@ -180,17 +182,23 @@ protected function addTabToForm($model, $fieldsetId = 'conditions_fieldset', $fo
|
180 | 182 | }
|
181 | 183 |
|
182 | 184 | /**
|
183 |
| - * @param \Magento\Rule\Model\Condition\AbstractCondition $conditions |
| 185 | + * @param RuleInterface $rule |
| 186 | + * @param AbstractCondition $conditions |
184 | 187 | * @param string $formName
|
185 | 188 | * @return void
|
186 | 189 | */
|
187 |
| - private function setConditionFormName(\Magento\CatalogRule\Api\Data\RuleInterface $rule, \Magento\Rule\Model\Condition\AbstractCondition $conditions, $formName) |
188 |
| - { |
| 190 | + private function setConditionFormName( |
| 191 | + RuleInterface $rule, |
| 192 | + AbstractCondition $conditions, |
| 193 | + $formName |
| 194 | + ) { |
189 | 195 | $conditions->setFormName($formName);
|
| 196 | + //For every fieldset there's a different form object. |
190 | 197 | $conditions->setJsFormObject(
|
191 | 198 | $rule->getConditionsFieldSetId($formName)
|
192 | 199 | );
|
193 |
| - if ($conditions->getConditions() && is_array($conditions->getConditions())) { |
| 200 | + $childConditions = $conditions->getCondition(); |
| 201 | + if ($childConditions && is_array($childConditions)) { |
194 | 202 | foreach ($conditions->getConditions() as $condition) {
|
195 | 203 | $this->setConditionFormName($rule, $condition, $formName);
|
196 | 204 | }
|
|
0 commit comments