Skip to content

Commit 6dd3327

Browse files
author
Stanislav Idolov
authored
ENGCOM-2225: [Backport] Small refactoring to better code readability #16632
2 parents eaf4fe6 + 57518c5 commit 6dd3327

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,18 @@ 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+
$params = $this->_getDependsJson();
125+
126+
if ($this->_configOptions) {
127+
$params .= ', ' . $this->_jsonEncoder->encode($this->_configOptions);
128+
}
129+
130+
return "<script>
131+
require(['mage/adminhtml/form'], function(){
132+
new FormElementDependenceController({$params});
133+
});
134+
</script>";
131135
}
132136

133137
/**

0 commit comments

Comments
 (0)