Skip to content

Commit 73dec0d

Browse files
authored
Update README.md
Explanations on how to override widget options for frontend developers.
1 parent a931675 commit 73dec0d

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,52 @@ After installation, a new widget type "Smile Custom Entity Widget" will be avail
6868

6969
The widget can be placed on any CMS page, block, or within layout XML, providing flexible integration options.
7070

71+
### Customizing Widget Options Through Theme Templates
72+
73+
To customize or extend the SmileCustomEntityWidget's options, you can override the widget configuration within your theme by creating a widget.xml file in your theme's configuration directory.
74+
75+
#### Instructions:
76+
77+
1. Create the following directory structure in your theme folder if it doesn't already exist:
78+
```
79+
app/design/frontend/YourVendor/YourTheme/Artbambou_SmileCustomEntityWidget/etc/
80+
```
81+
82+
2. Create a `widget.xml` file within this directory with the following structure:
83+
84+
```xml
85+
<?xml version="1.0" encoding="UTF-8"?>
86+
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
87+
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
88+
<widget id="artbambou_smile_custom_entity_set_widget">
89+
<parameters>
90+
<!-- Add or modify parameters here -->
91+
<parameter name="template" xsi:type="select" required="true" visible="true">
92+
<label translate="true">Template</label>
93+
<options>
94+
<option name="grid" value="Artbambou_SmileCustomEntityWidget::widget/grid.phtml">
95+
<label translate="true">Grid Template</label>
96+
</option>
97+
<option name="custom_list" value="YourVendor_YourTheme::smile_entity/custom_list.phtml">
98+
<label translate="true">Custom List Template</label>
99+
</option>
100+
<!-- Add more template options as needed -->
101+
</options>
102+
</parameter>
103+
</parameters>
104+
</widget>
105+
</widgets>
106+
```
107+
108+
3. After adding this file, clear the Magento cache:
109+
```bash
110+
bin/magento cache:clean
111+
```
112+
113+
This approach allows you to extend the widget configuration without modifying the core module code. You can add new template options, modify existing parameters, or introduce entirely new parameters to customize the widget's behavior to meet your specific design requirements.
114+
115+
Note that any custom templates referenced in your widget.xml must exist within your theme structure for them to work properly.
116+
71117
## Requirements
72118

73119
- Smile CustomEntity module

0 commit comments

Comments
 (0)