- Issue created by @joelseguin
- 🇩🇪Germany jurgenhaas Gottmadingen
It's not about the webform, as that's a config entity which exists once. This is about webform submissions, that are content entities, one for each submitted webform.
The webform submission entities have fields like uid, created, changed, notes, and others. The data, that's being entered into the form by the user is not stored in entity fields, they are stored separately. So, the entity field API cannot be used for webform submission data.
Looks like we need action plugins to get and set webform submission data.
Tagging for DrupalDevDays 2023, let's see if we can get around to work on this there.
- @jurgenhaas opened merge request.
- Status changed to Needs review
over 1 year ago 8:45am 31 July 2023 - 🇩🇪Germany jurgenhaas Gottmadingen
This MR comes with 2 new action plugins to get and set webform submission data.
- 🇨🇦Canada joelseguin Ontario, Canada
The updated MR works nicely now and I can set and get webform submission field values without issues (no errors in logs).
I'm attaching a screenshot with some thoughts to perhaps improve UX a bit in the future.
Explanation of the screenshot:
1. At first I was thinking that since I'm listening for a webform event on "Update Content Entity" that I could access webform submission data via "Entity: Set Field Value", but that's not quite the case (since we need eca_webform for this). Wondering if there shouldn't be a notice to users about this (especially if the Webform module is enabled) since it's not immediately obvious?
2. Also, when using the "Webform Submission: Set Data" action, I'm wondering if it's possible to allow the same options as found under the "Entity: Set Field Value" for consistency? This could be useful for those expecting the same functionality to be available.
- Status changed to RTBC
over 1 year ago 2:00pm 1 August 2023 - 🇩🇪Germany jurgenhaas Gottmadingen
Thanks @joelseguin for your feedback, and glad it now works.
WRT your suggestion 1: the "trouble" is that webform submissions do have fields, and they have submission data. So, as for the fields, the action
Entity: Set Field Value
needs to be used, and as for the submission data, the new action is required. So, there is a valid use case for both action plugins. And adding extra comments on theEntity: Set Field Value
action plugin when also webform submissions are available, would be a hard-coded extra case in a module that is not really dependent on the webform module. I'd rather defer that to the ECA Guide where we should describe how webform submissions can be handled.WRT your suggestion 2: the webform data is not entered and managed by the form API from Drupal, so the implementation of extra data handling is pretty hard, we would have to write extra complex code potentially all the field types that come with webforms. For now I would defer that to the ECA user's responsibility to provide the data in a way that's conformant with the data type that is about to be changed.
As for saving the entity, I would expect that webform submission data should only be altered in the presave entity event. Altering submission data later is kind of against the purpose of user provided input, isn't it? And with the presave event, you never want to save the entity anyways, as it happens along the way automatically. Should there be any different use case, there is still the
Save entity
action available.However, no reason why not to request these items as new features. That should then be done in separate issues for each of them.
For now, I'm going to merge this one and publish a stable release for eca_webform. Thanks for helping me out on it.
-
jurgenhaas →
committed b319f3eb on 1.0.x
Issue #3373313 by jurgenhaas, joelseguin: New actions to get and set...
-
jurgenhaas →
committed b319f3eb on 1.0.x
- Status changed to Fixed
over 1 year ago 2:03pm 1 August 2023 - 🇨🇦Canada joelseguin Ontario, Canada
Thanks for your thoughts on the suggestions - it all makes sense to me. Agree with #2 and not requiring the ability to save. A note in the documentation in regards to Webform submissions would certainly be sufficient.
Automatically closed - issue fixed for 2 weeks with no activity.