Skip to content

Commit

Permalink
Use field 'name' attribute (if set) as key in webform mapping, else u…
Browse files Browse the repository at this point in the history
…se machine name as usual.
  • Loading branch information
bgilhome-now committed Dec 12, 2024
1 parent d428e69 commit c2e3fdc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/ripple-tide-webform/mapping/webforms-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ export const getFormSchemaFromMapping = async (
const fields = []
const formId = webform.drupal_internal__id

for (const [fieldKey, fieldData] of Object.entries(elements)) {
for (const [fieldMachineName, fieldData] of Object.entries(elements)) {
let mappedField
const field: TideWebformElement = { ...fieldData, formId }
const fieldID = `${formId}_${fieldKey}`
const fieldID = `${formId}_${fieldMachineName}`
const fieldKey = field['#attributes']?.name || fieldMachineName

switch (field['#type']) {
case 'hidden':
Expand Down

0 comments on commit c2e3fdc

Please sign in to comment.