UNPKG

@websolutespa/payload-plugin-bowl

Version:

Bowl PayloadCms plugin of the BOM Repository

33 lines (32 loc) 813 B
import { deepMerge, formatSlug } from '@websolutespa/payload-utils'; import { withText } from './withText'; export const withSlug = ({ fieldToUse, ...options } = { fieldToUse: 'title' })=>{ return withText(deepMerge({ name: 'slug', localized: true, unique: true, hooks: { beforeValidate: [ formatSlug(fieldToUse) ] } }, options)); }; export const withSlugRequired = ({ fieldToUse, ...options } = { fieldToUse: 'title' })=>{ return withText(deepMerge({ name: 'slug', localized: true, unique: true, required: true, hooks: { beforeValidate: [ formatSlug(fieldToUse) ] } }, options)); }; //# sourceMappingURL=withSlug.js.map