Files
klz-cables.com/.pnpm-store/v10/files/fc/2b7b3d4e9e80e5782003a67da93fd5ea6423d000a601df6880e7a185b9e1ba367ca263f76b44fd78d53659b8de808a0831463939a1e130ad320c30bb41d935
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

74 lines
2.1 KiB
Plaintext

import { hasAutosaveEnabled, hasDraftsEnabled } from '../utilities/getVersionsConfig.js';
import { versionSnapshotField } from './baseFields.js';
export const buildVersionCollectionFields = (config, collection, flatten)=>{
const fields = [
{
name: 'parent',
type: 'relationship',
index: true,
relationTo: collection.slug
},
{
name: 'version',
type: 'group',
fields: collection.fields.filter((field)=>!('name' in field) || field.name !== 'id'),
...flatten && {
flattenedFields: collection.flattenedFields.filter((each)=>each.name !== 'id')
}
},
{
name: 'createdAt',
type: 'date',
admin: {
disabled: true
},
index: true
},
{
name: 'updatedAt',
type: 'date',
admin: {
disabled: true
},
index: true
}
];
if (hasDraftsEnabled(collection)) {
if (config.localization) {
fields.push(versionSnapshotField);
fields.push({
name: 'publishedLocale',
type: 'select',
admin: {
disableBulkEdit: true,
disabled: true
},
index: true,
options: config.localization.locales.map((locale)=>{
if (typeof locale === 'string') {
return locale;
}
return locale.code;
})
});
}
fields.push({
name: 'latest',
type: 'checkbox',
admin: {
disabled: true
},
index: true
});
if (hasAutosaveEnabled(collection)) {
fields.push({
name: 'autosave',
type: 'checkbox',
index: true
});
}
}
return fields;
};
//# sourceMappingURL=buildCollectionFields.js.map