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 e4b7eef commit 08051c0
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,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 08051c0

Please sign in to comment.