feat(plugin-form-builder)!: update form builder plugin field overrides to use a function instead (#6497)

## Description

Changes the `fields` override for form builder plugin to use a function
instead so that we can actually override existing fields which currently
will not work.

```ts
//before
fields: [
  {
    name: 'custom',
    type: 'text',
  }
]

// current
fields: ({ defaultFields }) => {
  return [
    ...defaultFields,
    {
      name: 'custom',
      type: 'text',
    },
  ]
}
```

## Type of change

- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
This commit is contained in:
Paul
2024-05-28 17:45:51 -03:00
committed by GitHub
parent b2662eeb1f
commit 7d0e909a30
5 changed files with 254 additions and 244 deletions

View File

@@ -73,12 +73,26 @@ export default buildConfigWithDefaults({
// singular: 'Contact Form',
// plural: 'Contact Forms'
// },
fields: [
{
name: 'custom',
type: 'text',
},
],
fields: ({ defaultFields }) => {
return [
...defaultFields,
{
name: 'custom',
type: 'text',
},
]
},
},
formSubmissionOverrides: {
fields: ({ defaultFields }) => {
return [
...defaultFields,
{
name: 'custom',
type: 'text',
},
]
},
},
redirectRelationships: ['pages'],
}),