From a2346f4697a76f1d9905dc9968a79b57a9909e2b Mon Sep 17 00:00:00 2001 From: "vadim.malesh" Date: Mon, 31 Aug 2020 10:53:52 +0300 Subject: [PATCH] refactor --- app/code/Magento/Widget/Model/Widget.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Widget/Model/Widget.php b/app/code/Magento/Widget/Model/Widget.php index 6d9bb1878708a..ec948063234da 100644 --- a/app/code/Magento/Widget/Model/Widget.php +++ b/app/code/Magento/Widget/Model/Widget.php @@ -313,7 +313,7 @@ public function getWidgetDeclaration($type, $params = [], $asIs = true) $directiveParams = ''; foreach ($params as $name => $value) { // Retrieve default option value if pre-configured - $directiveParams .= $this->getDirectiveParam($widget, $name, $value); + $directiveParams .= $value === null ? '' : $this->getDirectiveParam($widget, $name, $value); } $directive = sprintf('{{widget type="%s"%s%s}}', $type, $directiveParams, $this->getWidgetPageVarName($params)); @@ -354,9 +354,7 @@ private function getDirectiveParam(DataObject $widget, string $name, $value): st $value = $this->getPreparedValue($value); } - return $value !== null - ? sprintf(' %s="%s"', $name, $this->escaper->escapeHtmlAttr($value, false)) - : ''; + return sprintf(' %s="%s"', $name, $this->escaper->escapeHtmlAttr($value, false)); } /**