[webform_civicrm] - Webform CiviCRM module - Drupal 8 prototyping
I sat down with Will & David this week to take a look at what D8 Webform-CiviCRM might look like. I've been playing with the Webform 5 module and really love it. We talked about handlers and element types and the pros & cons of those. I'm still learning the new system so I may revise this, but here are my thoughts so far.
In Webform-CiviCRM D7, there is a massive configuration form for the CiviCRM-related form settings. It configures the data handling and it also auto-generates webform elements and links them to their corresponding CiviCRM entity field. It looks like this:
Note that checking a box on this form will actually insert a corresponding element into the Webform. I've always thought that was much more user-frieldly than the alternative of making the user create a new element and then go over to a "mapping" screen to link it to CiviCRM. So I'd like to keep that kind of behavior.
But playing around with the D8 interface, I think we could break this monolithic form up by entity and integrate it better with the webform admin screen. Here's my spitball proposal:
- Create a bunch of new "container" type elements, one per supported CiviCRM entity type (Contact, Participant, Activity, etc).
- Add a new button on the webform elements page to add these CiviCRM entity containers to the form.
- Adding one would automatically enable our CiviCRM submission handler.
- Editing a container would pop up a configuration form specific to that entity - it would look a lot like one of the panes on the webform-civicrm D7 admin screen above.
- Checking a checkbox on that form would result in a new webform element being added into the container.
- The admin user would still be free to move elements around and rename them. I don't see any reason why they wouldn't be able to move them outside of the container too. The mapping wouldn't be dependent on that.
- The entity container itself could be styled to look like a fieldset, flexbox, div, etc.
Here's a photoshopped mockup of what that might look like. Note that in D8, popups float to the right on wide screens, so what you're seeing here would be the result of clicking the "Edit" button on the CiviCRM contact.