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 \Rule \Model \Condition \AbstractCondition ;
11
12
12
13
class Conditions extends Generic implements TabInterface
13
14
{
@@ -146,14 +147,16 @@ protected function addTabToForm($model, $fieldsetId = 'conditions_fieldset', $fo
146
147
$ form = $ this ->_formFactory ->create ();
147
148
$ form ->setHtmlIdPrefix ('rule_ ' );
148
149
150
+ $ conditionsFieldSetId = $ model ->getConditionsFieldSetId ($ formName );
151
+
149
152
$ newChildUrl = $ this ->getUrl (
150
- 'catalog_rule/promo_catalog/newConditionHtml/form/ ' . $ model -> getConditionsFieldSetId ( $ formName ) ,
153
+ 'catalog_rule/promo_catalog/newConditionHtml/form/ ' . $ conditionsFieldSetId ,
151
154
['form_namespace ' => $ formName ]
152
155
);
153
156
154
157
$ renderer = $ this ->_rendererFieldset ->setTemplate ('Magento_CatalogRule::promo/fieldset.phtml ' )
155
158
->setNewChildUrl ($ newChildUrl )
156
- ->setFieldSetId ($ model -> getConditionsFieldSetId ( $ formName ) );
159
+ ->setFieldSetId ($ conditionsFieldSetId );
157
160
158
161
$ fieldset = $ form ->addFieldset (
159
162
$ fieldsetId ,
@@ -175,22 +178,24 @@ protected function addTabToForm($model, $fieldsetId = 'conditions_fieldset', $fo
175
178
->setRenderer ($ this ->_conditions );
176
179
177
180
$ form ->setValues ($ model ->getData ());
178
- $ this ->setConditionFormName ($ model ->getConditions (), $ formName );
181
+ $ this ->setConditionFormName ($ model ->getConditions (), $ formName, $ conditionsFieldSetId );
179
182
return $ form ;
180
183
}
181
184
182
185
/**
183
- * @param \Magento\Rule\Model\Condition\ AbstractCondition $conditions
186
+ * @param AbstractCondition $conditions
184
187
* @param string $formName
188
+ * @param string $jsFormName
185
189
* @return void
186
190
*/
187
- private function setConditionFormName (\ Magento \ Rule \ Model \ Condition \ AbstractCondition $ conditions , $ formName )
191
+ private function setConditionFormName (AbstractCondition $ conditions , $ formName, $ jsFormName )
188
192
{
189
193
$ conditions ->setFormName ($ formName );
190
- $ conditions ->setJsFormObject ($ formName );
194
+ $ conditions ->setJsFormObject ($ jsFormName );
195
+
191
196
if ($ conditions ->getConditions () && is_array ($ conditions ->getConditions ())) {
192
197
foreach ($ conditions ->getConditions () as $ condition ) {
193
- $ this ->setConditionFormName ($ condition , $ formName );
198
+ $ this ->setConditionFormName ($ condition , $ formName, $ jsFormName );
194
199
}
195
200
}
196
201
}
0 commit comments