Skip to content

Commit

Permalink
feat: spreads overrides into configs payloadcms#25 (payloadcms#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsfletch authored Jan 23, 2023
1 parent a93008c commit ef91380
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions demo/src/payload.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export default buildConfig({
'pages'
],
formOverrides: {
// labels: {
// singular: 'Contact Form',
// plural: 'Contact Forms'
// },
fields: [
{
name: 'name',
Expand Down
1 change: 1 addition & 0 deletions src/collections/FormSubmissions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import createCharge from './hooks/createCharge';
// all settings can be overridden by the config
export const generateSubmissionCollection = (formConfig: PluginConfig): CollectionConfig => {
const newConfig: CollectionConfig = {
...formConfig?.formSubmissionOverrides || {},
slug: formConfig?.formSubmissionOverrides?.slug || 'form-submissions',
access: {
create: () => true,
Expand Down
1 change: 1 addition & 0 deletions src/collections/Forms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const generateFormCollection = (formConfig: PluginConfig): CollectionConf
}

const config: CollectionConfig = {
...formConfig?.formOverrides || {},
slug: formConfig?.formOverrides?.slug || 'forms',
admin: {
useAsTitle: 'title',
Expand Down

0 comments on commit ef91380

Please sign in to comment.