Initial commit
This commit is contained in:
-36
@@ -1,36 +0,0 @@
|
||||
import { ALL_SYSTEM_PAGE_ROLES } from './types.js';
|
||||
/** Admin-facing labels per role. */ const ROLE_LABELS = {
|
||||
cookiePolicy: 'Cookie Policy',
|
||||
homepage: 'Homepage',
|
||||
privacyPolicy: 'Privacy Policy'
|
||||
};
|
||||
/** Admin descriptions per role. */ const ROLE_DESCRIPTIONS = {
|
||||
cookiePolicy: 'Page linked from the cookie consent banner.',
|
||||
homepage: 'Page served at the locale root (e.g. /pl, /en).',
|
||||
privacyPolicy: 'Page linked as the privacy policy.'
|
||||
};
|
||||
/**
|
||||
* Builds one relationship field per configured system-page role.
|
||||
*
|
||||
* Each field points at the client's Pages collection (via the provided slug)
|
||||
* and holds a single document reference. The referenced document's slug is
|
||||
* localized, so the same assignment resolves to /pl/strona-glowna and
|
||||
* /en/home at runtime — role assignment is locale-agnostic, path resolution
|
||||
* is locale-aware (see getSystemPagePath).
|
||||
*/ export function buildSystemPagesFields(pages) {
|
||||
const roles = pages.roles?.length ? pages.roles : [
|
||||
...ALL_SYSTEM_PAGE_ROLES
|
||||
];
|
||||
return roles.map((role)=>({
|
||||
name: role,
|
||||
type: 'relationship',
|
||||
admin: {
|
||||
description: ROLE_DESCRIPTIONS[role]
|
||||
},
|
||||
label: ROLE_LABELS[role],
|
||||
maxDepth: 1,
|
||||
relationTo: pages.slug
|
||||
}));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=systemPagesFields.js.map
|
||||
Reference in New Issue
Block a user