Skip to content

Commit

Permalink
magento2/issues/12087: Changes for Adminhtml Widget Options class.
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Kilo committed Jul 6, 2020
1 parent 7f0f260 commit 2a48abe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ protected function _addField($parameter)
$data['value'] = $parameter->getValue();
}

if ($parameter->getType() == 'text' && $data['value'] != '') {
$data['value'] = $this->_widget->decodeReservedChars($data['value']);
}

//prepare unique id value
if ($fieldName == 'unique_id' && $data['value'] == '') {
$data['value'] = hash('sha256', microtime(1));
Expand Down
18 changes: 18 additions & 0 deletions app/code/Magento/Widget/Model/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,24 @@ private function encodeReservedChars($string)
);
}

/**
* @param $string
* @return array
*/
public function decodeReservedChars($string)
{
$map = [
'{' => urlencode('{'),
'}' => urlencode('}')
];

return str_replace(
array_values($map),
array_keys($map),
$string
);
}

/**
* @param $widget
* @param $name
Expand Down

0 comments on commit 2a48abe

Please sign in to comment.