Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When building Webform integrations in other modules it can be useful to have a simple way of mapping a set of data against the current webform.
Proposed resolution
Provide a new field element that extends WebformMapping with the source predefined to show the list of available fields on this webform.
Comment | File | Size | Author |
---|---|---|---|
#4 | webform-n2950864-4.interdiff.txt | 1.26 KB | DamienMcKenna |
#4 | webform-n2950864-4.patch | 2.52 KB | DamienMcKenna |
| |||
#3 | webform-n2950864-2.patch | 2.22 KB | DamienMcKenna |
|
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@damienmckenna Yep the WebformMapping element could be extended to create a WebformElementsMapping.
My long-term dream is to have a WebformHandler that maps a webform's submission data to any entity's fields. There is even a prototype of the UI.
Comment #3
DamienMcKennaWIP.
Comment #4
DamienMcKennaMinor tweaks. Just need to settle on a class name and then tests?
Comment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedIf a field definition key matches an element key, it will overwrite the element's definition. The existing WebformExcludedColumns element has the same problem.
The solution I have used in other places is to prefix element keys with 'element__' in \Drupal\webform\Plugin\WebformElementBase::getTableColumn.
We probably need to dedicated ticket to fix the excluded columns issues.
Maybe the new element's name should WebformSubmissionMapping?
This would allow the WebformSubmissionMapping element to be extended to create a WebformSubmissionToMyCrmMapping element.
Comment #6
DamienMcKennaComment #7
DamienMcKennaAlso, the use of $this in listAllFields() breaks OOP because processWebformMapping() is static.
Comment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@DamienMcKenna I am not sure this type of element is immediately needed in the Webform (core) module maybe this code can be developed as an experimental module.
Comment #9
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented