Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Charlie committed Sep 4, 2020
1 parent a2346f4 commit 74325ef
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/code/Magento/Widget/Model/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,14 @@ public function getWidgetDeclaration($type, $params = [], $asIs = true)
{
$widget = $this->getConfigAsObject($type);

$params = array_filter($params, function ($value) {
return $value !== null;
});

$directiveParams = '';
foreach ($params as $name => $value) {
// Retrieve default option value if pre-configured
$directiveParams .= $value === null ? '' : $this->getDirectiveParam($widget, $name, $value);
$directiveParams .= $this->getDirectiveParam($widget, $name, $value);
}

$directive = sprintf('{{widget type="%s"%s%s}}', $type, $directiveParams, $this->getWidgetPageVarName($params));
Expand Down

0 comments on commit 74325ef

Please sign in to comment.