feat(plugin-redirects)!: update fields overrides to use a function (#6675)

## Description

Updates the `fields` override in plugin redirects to allow for
overriding

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

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


## Type of change

- [x] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
This commit is contained in:
Paul
2024-06-07 10:41:09 -04:00
committed by GitHub
parent 7c8d562f03
commit e4a90294ea
4 changed files with 92 additions and 108 deletions

View File

@@ -27,6 +27,17 @@ export default buildConfigWithDefaults({
plugins: [
redirectsPlugin({
collections: ['pages'],
overrides: {
fields: ({ defaultFields }) => {
return [
...defaultFields,
{
type: 'text',
name: 'customField',
},
]
},
},
}),
],
})