The webform content creator is a great module and a real asset to the webform suite of modules, the issue I see is that at the moment field support is limited to just what the module provides where it feels like this could be easily opened up to make use of the plugin system.
I realised this as I was trying to add a patch to enable the mapped value to be adapted, in my case to allow address fields to be utilised.
I suspect the best approach would be to add a ContentCreatorSourceMap plugin, which would be selectable when mapping the field, with just a few attributes
* label
* [webform_element_types]
and would just have a mapValue() method.
By default you could just have an EntityReferenceContentCreatorSourceMap, CheckboxContentCreatorSourceMap, DefaultContentCreatorSourceMap which would just allow the logic in the entity mapNodeField method to be largely abstracted away. And could then be easily extended for other element types.
If I get time I'll try to take a bit more of a look at this, if it's something you think makes sense.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 3163207-very-early-pass-at-plugin-manager.patch | 14.09 KB | andy_w |
| #2 | 3163207-initial-hook-to-allow-mapped-value-to-be-altered.patch | 4.3 KB | andy_w |
Comments
Comment #2
andy_w commentedComment #3
andy_w commentedSo I made use of this hook to make address fields (from the loqate module) work, but could then be utilised for all sorts of complex field support
Comment #4
joaomarques736 commentedHi andy_w,
This would be an excellent feature and really makes sense! The mapNodeField method should only have the basic logic related to it, and for the complex fields we could have a plugin to extend it, as you say. Can you help me on this?
Best regards and thank you for your hard work!
Comment #5
andy_w commentedI can try to take a look :)
Comment #6
andy_w commentedI've added a very early pass at a source map type plugin and manager, this is still conceptual at this stage. I think the next step would be to add some functional tests to be able to continue this with confidence if we think the direction has potential / value.
Comment #7
jacobbell84 commentedHi @andy_w,
I came to the same conclusion in this thread (https://www.drupal.org/project/webform_content_creator/issues/3058868) and had begun to work on a plugin system a little while back. Maybe we join forces on this? I like the the approach in yours allowing the user to choose which plugin to use. In mine, I have all the core functionality reworked in plugins, along with some more advanced features like being able to map basic fields to more complex field types (in case there isn't a perfect match for the field in webforms). I think we could take the best of both patches and come up with a pretty comprehensive solution.
Comment #8
joaomarques736 commentedHello andy_w and jacobbell84,
This idea of a new plugin system is excellent and i would say exactly the same: the idea is the same but the implementation is a little bit different, so it would be nice to get the best of both approaches and i would like to apply this in a new release (2.0.0). It would improve scalability and it would be easier to add support for complex fields (images, datetimes, links, dynamic entity references ..) and in an organized way.
Best regards and thank you for your contribution!
Comment #9
jacobbell84 commented@joaomarques736 Excellent, that's great to hear! Thank you for for all the work you've done on this module, I've used it a on a few projects already.
Comment #10
dgaspara commentedComment #11
jacobbell84 commentedComment #12
styrbaekCould anyone help creating this patch for version 2.x?
Comment #13
pcate commentedI'm very excited about this new plugin system. It will add support the several additional fields types that's currently preventing me from using the module for a project.
I am a bit confused about which issue the development of the plugin system is being done in though. There has been work in this issue, but also in https://www.drupal.org/project/webform_content_creator/issues/3058868 and there are separate several issues for adding new field types that I think will be addressed with the new plugin system. Do we need to consolidate these issues, or at least create a meta issue?
Also, it looks like the new plugin system will be in v3 release of the module? Is there an ETA when we might be a version 3 alpha?
Comment #14
joaomarques736 commentedComment #15
joaomarques736 commentedHello andy_w and jacobbell84,
Thanks for your great contribution with the new plugin system, I tried to join some things of each patch to make a release (3.0.0-alpha) with this plugin system, which will allow any person to extend the module and map any field types.
Best regards!
Comment #16
joaomarques736 commentedComment #17
joaomarques736 commented