Skip to content

Commit 270640f

Browse files
likemusicronak2ram
authored andcommitted
small refactoring to better code readability
1 parent b5f47a1 commit 270640f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,17 @@ protected function _toHtml()
120120
if (!$this->_depends) {
121121
return '';
122122
}
123-
return '<script>
124-
require(["mage/adminhtml/form"], function(){
125-
new FormElementDependenceController(' .
126-
$this->_getDependsJson() .
127-
($this->_configOptions ? ', ' .
128-
$this->_jsonEncoder->encode(
129-
$this->_configOptions
130-
) : '') . '); });</script>';
123+
124+
$dependsJson = $this->_getDependsJson();
125+
$configOptions = $this->_configOptions ? $this->_jsonEncoder->encode($this->_configOptions) : null;
126+
$configOptionsStr = $configOptions ? ', ' . $configOptions : '';
127+
$paramsStr = $dependsJson . $configOptionsStr;
128+
129+
return "<script>
130+
require(['mage/adminhtml/form'], function(){
131+
new FormElementDependenceController({$paramsStr});
132+
});
133+
</script>";
131134
}
132135

133136
/**

0 commit comments

Comments
 (0)