55 lines
1.8 KiB
JavaScript
55 lines
1.8 KiB
JavaScript
import { generalFields } from './fields/general.js';
|
|
import { themeFields } from './fields/theme.js';
|
|
/**
|
|
* Builds the SiteSettings global.
|
|
*
|
|
* Composes tabs out of field groups; it deliberately doesn't know where those
|
|
* groups come from. Earlier it imported the pages and content modules directly,
|
|
* which meant a global — a presentation-layer concern — had an opinion about
|
|
* blogs. Now the plugin's composition root passes fields in, and adding a new
|
|
* kind of page assignment needs no change here.
|
|
*
|
|
* Uses unnamed tabs — data stays flat (siteSettings.siteName, not
|
|
* siteSettings.general.siteName). Client-provided fields land in their own
|
|
* "Custom" tab so core data paths never shift.
|
|
*/ export function buildSiteSettings({ additionalFields, systemPageFields } = {}) {
|
|
return {
|
|
slug: 'site-settings',
|
|
access: {
|
|
read: ()=>true
|
|
},
|
|
admin: {
|
|
group: 'Settings'
|
|
},
|
|
fields: [
|
|
{
|
|
type: 'tabs',
|
|
tabs: [
|
|
{
|
|
fields: generalFields,
|
|
label: 'General'
|
|
},
|
|
{
|
|
fields: themeFields,
|
|
label: 'Theme'
|
|
},
|
|
...systemPageFields?.length ? [
|
|
{
|
|
fields: systemPageFields,
|
|
label: 'System Pages'
|
|
}
|
|
] : [],
|
|
...additionalFields?.length ? [
|
|
{
|
|
fields: additionalFields,
|
|
label: 'Custom'
|
|
}
|
|
] : []
|
|
]
|
|
}
|
|
],
|
|
label: 'Site Settings'
|
|
};
|
|
}
|
|
|
|
//# sourceMappingURL=index.js.map
|