From e4b7eef3d09110e9faec35f166ea8ed02dc71503 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 08051c0a608dc9c7cacddf56f14fa3888b42b684 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 ""; }