Creating a widget with options
If you select one of the existing widgets, you can see that some of them come with configurations options. The widget we created is very basic and now we are going to see how to add some simple options that will allow the store manager to customize the frontend block. The plan is to allow the user to choose which services to display on the frontend.
The options we are going to insert are as follows:
One checkbox option that shows or hides the shares count bubble
One input textbox that allows you to insert a block title
Adding options to our widget.xml
To add some options to our widget, you need to edit the widget.xml
file by adding the following parameters:
required
: This is used to define if an option is required or notvisible
: This is used to set the visibility of an optionlabel
: This is used to set the option titletype
: This is used to set the type of the option (checkbox, text, and so on)
To start adding options to the widget, return to the widget.xml
file...