Skip to content

Commit 3ec7e6d

Browse files
likemusicronak2ram
authored andcommitted
improve params string creation according to @orlangur suggestion
1 parent 270640f commit 3ec7e6d

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,15 @@ protected function _toHtml()
121121
return '';
122122
}
123123

124-
$dependsJson = $this->_getDependsJson();
125-
$configOptions = $this->_configOptions ? $this->_jsonEncoder->encode($this->_configOptions) : null;
126-
$configOptionsStr = $configOptions ? ', ' . $configOptions : '';
127-
$paramsStr = $dependsJson . $configOptionsStr;
124+
$params = $this->_getDependsJson();
125+
126+
if ($this->_configOptions) {
127+
$params .= ', ' . $this->_jsonEncoder->encode($this->_configOptions);
128+
}
128129

129130
return "<script>
130-
require(['mage/adminhtml/form'], function(){
131-
new FormElementDependenceController({$paramsStr});
131+
require(['mage/adminhtml/form'], function(){
132+
new FormElementDependenceController({$params});
132133
});
133134
</script>";
134135
}

0 commit comments

Comments
 (0)