From 09ed619adf73a7be265297686695e0a011a4b0cc Mon Sep 17 00:00:00 2001 From: Valerij Ivashchenko Date: Mon, 11 Jun 2018 15:47:43 +0300 Subject: [PATCH 1/2] small refactoring to better code readability --- .../Block/Widget/Form/Element/Dependence.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php b/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php index 723deab1e9f7e..c3f83e06858d8 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php @@ -124,14 +124,17 @@ protected function _toHtml() if (!$this->_depends) { return ''; } - return ''; + + $dependsJson = $this->_getDependsJson(); + $configOptions = $this->_configOptions ? $this->_jsonEncoder->encode($this->_configOptions) : null; + $configOptionsStr = $configOptions ? ', ' . $configOptions : ''; + $paramsStr = $dependsJson . $configOptionsStr; + + return ""; } /** From 717688e7be19d3b29a4c005b71807a55d1101723 Mon Sep 17 00:00:00 2001 From: Valerij Ivashchenko Date: Tue, 12 Jun 2018 10:57:28 +0300 Subject: [PATCH 2/2] improve params string creation according to @orlangur suggestion --- .../Block/Widget/Form/Element/Dependence.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php b/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php index c3f83e06858d8..eff49c3b75ab2 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php @@ -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 ""; }