Skip to content

Commit

Permalink
improve params string creation according to @orlangur suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
likemusic authored and ronak2ram committed Jul 8, 2018
1 parent 270640f commit 3ec7e6d
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,15 @@ protected function _toHtml()
return '';
}

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

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

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

0 comments on commit 3ec7e6d

Please sign in to comment.