Skip to content

Commit 5a764b2

Browse files
author
Stanislav Idolov
authored
ENGCOM-2226: [Forwardport] Small refactoring to better code readability #16630
2 parents a225a11 + e701de3 commit 5a764b2

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
@@ -124,14 +124,18 @@ 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+
$params = $this->_getDependsJson();
129+
130+
if ($this->_configOptions) {
131+
$params .= ', ' . $this->_jsonEncoder->encode($this->_configOptions);
132+
}
133+
134+
return "<script>
135+
require(['mage/adminhtml/form'], function(){
136+
new FormElementDependenceController({$params});
137+
});
138+
</script>";
135139
}
136140

137141
/**

0 commit comments

Comments
 (0)