From c2e3fdc1c2e3e4f0de476c74f4b0875730a72a91 Mon Sep 17 00:00:00 2001 From: Bryce Gilhome Date: Thu, 12 Dec 2024 16:08:34 +1100 Subject: [PATCH] Use field 'name' attribute (if set) as key in webform mapping, else use machine name as usual. --- packages/ripple-tide-webform/mapping/webforms-mapping.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/ripple-tide-webform/mapping/webforms-mapping.ts b/packages/ripple-tide-webform/mapping/webforms-mapping.ts index 87c62cf485..e17b7c5d83 100644 --- a/packages/ripple-tide-webform/mapping/webforms-mapping.ts +++ b/packages/ripple-tide-webform/mapping/webforms-mapping.ts @@ -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':