Skip to content

Commit 6a11e9e

Browse files
authored
ENGCOM-4170: [Widget] Fixing the multidimensional array as value for the widget's parameter #21008
2 parents 4348f61 + 4cb1e44 commit 6a11e9e

File tree

2 files changed

+17
-9
lines changed
  • app/code/Magento/Widget/Block/Adminhtml/Widget
  • lib/internal/Magento/Framework/Data/Form/Element

2 files changed

+17
-9
lines changed

app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function getMainFieldset()
9191
if ($this->_getData('main_fieldset') instanceof \Magento\Framework\Data\Form\Element\Fieldset) {
9292
return $this->_getData('main_fieldset');
9393
}
94-
$mainFieldsetHtmlId = 'options_fieldset' . md5($this->getWidgetType());
94+
$mainFieldsetHtmlId = 'options_fieldset' . hash('sha256', $this->getWidgetType());
9595
$this->setMainFieldsetHtmlId($mainFieldsetHtmlId);
9696
$fieldset = $this->getForm()->addFieldset(
9797
$mainFieldsetHtmlId,
@@ -141,7 +141,6 @@ protected function _addField($parameter)
141141
{
142142
$form = $this->getForm();
143143
$fieldset = $this->getMainFieldset();
144-
//$form->getElement('options_fieldset');
145144

146145
// prepare element data with values (either from request of from default values)
147146
$fieldName = $parameter->getKey();
@@ -166,9 +165,13 @@ protected function _addField($parameter)
166165

167166
if (is_array($data['value'])) {
168167
foreach ($data['value'] as &$value) {
169-
$value = html_entity_decode($value);
168+
if (is_string($value)) {
169+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
170+
$value = html_entity_decode($value);
171+
}
170172
}
171173
} else {
174+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
172175
$data['value'] = html_entity_decode($data['value']);
173176
}
174177

lib/internal/Magento/Framework/Data/Form/Element/Label.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/**
8-
* Data form abstract class
9-
*
10-
* @author Magento Core Team <[email protected]>
11-
*/
127
namespace Magento\Framework\Data\Form\Element;
138

9+
use Magento\Framework\Phrase;
10+
11+
/**
12+
* Label form element.
13+
*/
1414
class Label extends \Magento\Framework\Data\Form\Element\AbstractElement
1515
{
1616
/**
@@ -37,8 +37,13 @@ public function __construct(
3737
public function getElementHtml()
3838
{
3939
$html = $this->getBold() ? '<div class="control-value special">' : '<div class="control-value">';
40-
$html .= $this->getEscapedValue() . '</div>';
40+
if (is_string($this->getValue()) || $this->getValue() instanceof Phrase) {
41+
$html .= $this->getEscapedValue();
42+
}
43+
44+
$html .= '</div>';
4145
$html .= $this->getAfterElementHtml();
46+
4247
return $html;
4348
}
4449
}

0 commit comments

Comments
 (0)