I really like the widget builder as a flexible way to create user-friendly custom widgets. However, I feel like part of its power is hindered by only allowing a fixed, static set of fields for a widget.
For example, imagine a custom image slider widget. In the current version, a widget can have fields (such as title and source) for several images. So:
- Image 1 Title
- Image 1 Source
- Image 2 Title
- Image 2 Source
- Image 3 Title
- Image 3 Source
However, what this widget cannot do is allow for an arbitrary number of images. There is no way for the user to add more images to the slider.
It would be very useful to allow the user to add or remove fields from a widget, according to certain rules set by a developer. An example of how to do this would be to allow the developer to define a group of inputs known as an “image”, which has a title and a source, and then allow the user to add or remove these groups of fields from the widget. On the developer side, these arbitrary number of images could be accessed through some sort of loop statement.
So it’d look something like:
(user editing the widget)
- Images
- Image 1 [delete]
- Title
- Source
-Image 2 [delete] - Title
- Source
[add]
(widget display html code)
{{for $image in $images}}
{{endfor}}
I think this would greatly increase the flexibility of the (already flexible) widget builder.
Thanks!