Replies: 4 comments
|
I'm not keen on the sentinel-based approach. It's fragile, and every other consumer of options would need special handling or they'd just see it raw. I think the better approach is a |
|
I like this feature. Can we also make it possible to enforce a depth range for hierarchical taxonomies? For example:
We should be able to prevent users from selecting Europe or North America if we expect them to select a particular country. |
|
Here is a concrete SchemaAdd interface RepeaterSubField {
slug: string;
type: "string" | ... | "select" | "image" | "taxonomyTerm";
label: string;
required?: boolean;
options?: string[]; // select only (unchanged)
taxonomy?: string; // taxonomyTerm only (required): taxonomy name
termDepth?: { min?: number; max?: number }; // taxonomyTerm only, optional
}No sentinel, no special-casing in Stored valueStore the term slug (not the label): stable across label renames — which is the drift problem that motivated this — and still readable in the entry JSON. Alternative would be the term id (survives slug edits, but opaque in data and awkward for front-end queries). Happy to go either way; slug is my default. Admin UIReuses the searchable Depth range (@MA2153's request)Optional Validation
Non-goals for v1Multi-term sub-fields, creating terms inline from the combobox, and any write-path coupling (assignments still live in Purely additive; nothing changes for existing schemas. Does this shape work for you? |
|
Plus one from me! |
Uh oh!
There was an error while loading. Please reload this page.
Follow-up to #1657 (searchable combobox for repeater
selectsub-fields), whose code comment already anticipates "taxonomy-derived options".Problem: A repeater
selectsub-field can only offer a static option list duplicated in the collection schema. For options that mirror a taxonomy (e.g. aservicesrepeater picking from atreatmenttaxonomy), the list drifts out of sync as terms are added/renamed.Proposal: When a
selectsub-field'soptionsis the single sentinel@taxonomy:<name>, populate its (already searchable) combobox with that taxonomy's live terms via the existingGET /taxonomies/:name/termsAPI. Purely additive — any leading non-sentinel option keeps the current static behavior; stored values remain term labels.\n\nImplementation is minimal (admin-only, reusesfetchTerms+ the existingComboboxmarkup). PR ready at #1704. Opening this per the Feature/Discussion policy — happy to adjust the API shape (e.g. a typedoptionsTaxonomyfield instead of the string sentinel) if preferred.All reactions