magento2-configurator icon indicating copy to clipboard operation
magento2-configurator copied to clipboard

Widgets parameters

Open readio opened this issue 4 years ago • 1 comments

When creating widgets I get the below error in Magento admin when trying to view the created widget:

Exception #0 (InvalidArgumentException): Unable to unserialize value. Error: Syntax error

This seems to be caused by the way key/values are created. Using the code from the sample widget.yaml it creates the below in the database field 'widget_parameters' :

a:1:{s:8:"block_id";s:1:"1";}

If I manually change this to below the error goes away.

{"block_id":"1"}

Is this a known issue?

readio avatar Sep 08 '19 08:09 readio

I have fixed this by changing the 'populateWidgetParameters' function in 'Components/Widgets.php'

I have changed

return serialize($parameters);

to

return json_encode($parameters);

This inserts the parameters into the database in the correct format.

readio avatar Sep 08 '19 08:09 readio