- 🇬🇧United Kingdom mistergroove
This is great. Can this be added to a release?
- 🇨🇦Canada teknocat
Damn, I just did my own thing from scratch in my own custom module before seeing this. However, I went a slightly different way by extending the OptionsBase webform field type and using WebformEntityReferenceTrait and WebformEntityOptionsTrait. I started by looking at what the Webform Entity Checkboxes field type did, then figured out how to use the bits of that that made the most sense to turn it into a checkbox tree using this module.
I'll create an issue fork and submit a merge request with my idea so everyone can review and figure out what makes the most sense.
- 🇨🇦Canada teknocat
So it seems that this widget simply doesn't function fully, with either patch #4 or the version I've put together in my branch. The default value can never seem to be set, nor does it return the selected value(s) correctly in the webform.
Inspecting the rendered form reveals why - the field name has some complexities to it that will require the implementation of setValueCallback and getValueCallback in the webform element class. This is taken care of in the Term Reference Tree widget for use with fieldable entities, so that needs to be replicated for the webform module.
I'll try to get this figured out and comment when I've got something that actually works.
- 🇨🇦Canada teknocat
The last several commits to my issue fork seem to have this now working fully. Some things from patch #4 were correct and thus incorporated.
I have tested a form using test values, then edited the submission and the widget seems to be working so far.