Skip to content

Commit

Permalink
small refactoring to better code readability
Browse files Browse the repository at this point in the history
  • Loading branch information
likemusic authored and ronak2ram committed Jul 8, 2018
1 parent 0c2fa6f commit e4b7eef
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 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,17 @@ 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>';

$dependsJson = $this->_getDependsJson();
$configOptions = $this->_configOptions ? $this->_jsonEncoder->encode($this->_configOptions) : null;
$configOptionsStr = $configOptions ? ', ' . $configOptions : '';
$paramsStr = $dependsJson . $configOptionsStr;

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

/**
Expand Down

0 comments on commit e4b7eef

Please sign in to comment.