@nexo-labs/payload-taxonomies
Version:
Taxonomies for Payload CMS
22 lines (21 loc) • 650 B
JavaScript
import "@nexo-labs/hegel";
import { COLLECTION_SLUG_TAXONOMY } from "./taxonomy";
export const taxonomyRelationship = {
name: "categories",
label: "Categorías",
type: "relationship",
relationTo: COLLECTION_SLUG_TAXONOMY,
defaultValue: [],
hasMany: true,
required: false,
};
export const buildTaxonomyRelationship = (field) => ({
name: field?.name ?? "categories",
label: field?.label ?? "Categorías",
type: "relationship",
defaultValue: field?.defaultValue,
filterOptions: field?.filterOptions,
required: field?.required ?? false,
hasMany: true,
relationTo: COLLECTION_SLUG_TAXONOMY,
});