Skip to content

Commit 09ed619

Browse files
committed
small refactoring to better code readability
1 parent 38d7977 commit 09ed619

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
@@ -124,14 +124,17 @@ protected function _toHtml()
124124
if (!$this->_depends) {
125125
return '';
126126
}
127-
return '<script>
128-
require(["mage/adminhtml/form"], function(){
129-
new FormElementDependenceController(' .
130-
$this->_getDependsJson() .
131-
($this->_configOptions ? ', ' .
132-
$this->_jsonEncoder->encode(
133-
$this->_configOptions
134-
) : '') . '); });</script>';
127+
128+
$dependsJson = $this->_getDependsJson();
129+
$configOptions = $this->_configOptions ? $this->_jsonEncoder->encode($this->_configOptions) : null;
130+
$configOptionsStr = $configOptions ? ', ' . $configOptions : '';
131+
$paramsStr = $dependsJson . $configOptionsStr;
132+
133+
return "<script>
134+
require(['mage/adminhtml/form'], function(){
135+
new FormElementDependenceController({$paramsStr});
136+
});
137+
</script>";
135138
}
136139

137140
/**

0 commit comments

Comments
 (0)