Skip to content

Commit 717688e

Browse files
committed
improve params string creation according to @orlangur suggestion
1 parent 09ed619 commit 717688e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,15 @@ protected function _toHtml()
125125
return '';
126126
}
127127

128-
$dependsJson = $this->_getDependsJson();
129-
$configOptions = $this->_configOptions ? $this->_jsonEncoder->encode($this->_configOptions) : null;
130-
$configOptionsStr = $configOptions ? ', ' . $configOptions : '';
131-
$paramsStr = $dependsJson . $configOptionsStr;
128+
$params = $this->_getDependsJson();
129+
130+
if ($this->_configOptions) {
131+
$params .= ', ' . $this->_jsonEncoder->encode($this->_configOptions);
132+
}
132133

133134
return "<script>
134-
require(['mage/adminhtml/form'], function(){
135-
new FormElementDependenceController({$paramsStr});
135+
require(['mage/adminhtml/form'], function(){
136+
new FormElementDependenceController({$params});
136137
});
137138
</script>";
138139
}

0 commit comments

Comments
 (0)