This repository was archived by the owner on Dec 13, 2023. It is now read-only.
This repository was archived by the owner on Dec 13, 2023. It is now read-only.
add fields to form-fields #35
Closed
Description
Currently it is possible to overwrite the fields of the form-field blocks completely, but it is not possible to add an additional custom field.
If I'd like to add the custom field 'test', all other fields are gone.
formBuilder({ fields: { email: { fields: [ { name: 'test', type: 'text', }, ], }, }, })
I think, it's because the the merge in
is configured to replace the fields array.
I know that there are cases where one wants to redefine all form-fields, however it would be nice if a way to simply add custom fields to an form-field could be provided.
I thought about two possible ways to achieve this:
- add an additional property 'addFields' to the formBuilder incomingFormConfig.field.[FIELD_SLUG] object and add these fields after the merge step of the generateFormCollection function.
- expose the definition of the default form-fields configuration so that it can be imported and be reused the custom config. E.g. like this:
import formFields from '@payloadcms/plugin-form-builder/'; [...] formBuilder({ fields: { email: { fields: [ ...formFields.email.fields, { name: 'test', type: 'text', }, ], }, }, })
Metadata
Metadata
Assignees
Labels
No labels