Skip to content

Commit

Permalink
ENGCOM-2226: [Forwardport] Small refactoring to better code readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Idolov authored Jul 12, 2018
2 parents a225a11 + e701de3 commit 5a764b2
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,18 @@ protected function _toHtml()
if (!$this->_depends) {
return '';
}
return '<script>
require(["mage/adminhtml/form"], function(){
new FormElementDependenceController(' .
$this->_getDependsJson() .
($this->_configOptions ? ', ' .
$this->_jsonEncoder->encode(
$this->_configOptions
) : '') . '); });</script>';

$params = $this->_getDependsJson();

if ($this->_configOptions) {
$params .= ', ' . $this->_jsonEncoder->encode($this->_configOptions);
}

return "<script>
require(['mage/adminhtml/form'], function(){
new FormElementDependenceController({$params});
});
</script>";
}

/**
Expand Down

0 comments on commit 5a764b2

Please sign in to comment.