type

Definition

type Definition struct { name string kind Kind label string labelTranslations map[string]string required bool unique bool index bool localized bool minLength *int maxLength *int minimum *float64 maximum *float64 step *float64 defaultValue *DefaultValue slugSource string slugConfigured bool choices []Choice selectMany bool selectDefaults []string relationTo []string relationMany bool fields []Definition blocks []Block tabs []TabDefinition pluginKey string pluginConfig json.RawMessage pluginReferenceKeys []string adminPluginKey string adminComponent string adminComponentConfig json.RawMessage adminComponentConfigured bool description string descriptionTranslations map[string]string placeholder string placeholderTranslations map[string]string readOnly bool hidden bool sidebar bool columns int tab string tabTranslations map[string]string condition *Condition codeLanguage string datePickerAppearance DatePickerAppearance minRows int maxRows int rowLabel string rowLabelAdminPluginKey string rowLabelComponent string rowLabelComponentConfig json.RawMessage rowLabelComponentConfigured bool rowLabels RowLabels initiallyCollapsed bool joinCollection string joinOn string joinLimit int joinDefaultColumns []string joinDefaultSort string joinAllowCreate bool joinCreateConfigured bool valueType ValueType relationshipFilters []RelationshipFilterRule referenceDeleteAction ReferenceDeleteAction issues []Issue }

An immutable authored field definition.

Source field/field.go:274

Name()string
Authored storage or presentation name.
Kind()Kind
Built-in or plugin field kind.
Label()string
Author-facing label.
LabelTranslations()map[string]string
Translated labels keyed by admin language.
Required()bool
Whether a stored value is required.
Unique()bool
Whether stored values must be unique.
Index()bool
Whether the field requests an index.
Localized()bool
Whether values are stored per locale.
RelationshipTarget()string
Single relationship target, when configured.
RelationshipTargets()[]string
Defensive copy of every relationship target.
RelationshipHasMany()bool
Whether the relationship stores multiple targets.
SelectHasMany()bool
Whether a select stores an ordered list of choices.
SelectDefaults()[]string
Detached ordered defaults for a multi-select.
Category()Category
Scalar, nested, presentation, relationship, upload, or plugin behavior.
Default()(DefaultValue, bool)
Typed scalar default and whether one exists.
SlugSource()(string, bool)
Source path and whether first-class slug behavior is configured.
Choices()[]Choice
Defensive copy of select or radio choices.
Fields()[]Definition
Defensive copy of nested fields.
Blocks()[]Block
Defensive copy of allowed block layouts.
Tabs()[]TabDefinition
Defensive copy of tab definitions.
PluginKey()string
Stable plugin field key.
AdminComponent()(pluginKey, component string, config json.RawMessage, ok bool)
Detached exact renderer selection and whether one was configured.
Description()string
Author-facing help text.
DescriptionTranslations()map[string]string
Translated help text keyed by admin language.
Placeholder()string
Canonical empty-state prompt for compatible controls.
PlaceholderTranslations()map[string]string
Translated empty-state prompts keyed by admin language.
ReadOnly()bool
Whether the admin renders the field as read-only.
Hidden()bool
Whether the admin omits the field from presentation.
Sidebar()bool
Whether a root field belongs in the document editor side rail.
Columns()int
Requested row-layout column span.
Tab()string
Authored tab association.
TabTranslations()map[string]string
Translated tab labels keyed by admin language.
Condition()*Condition
Detached conditional-display rule, when configured.
CodeLanguage()string
Syntax language hint for code fields.
MinLength()(int, bool)
Minimum string length and whether it is set.
MaxLength()(int, bool)
Maximum string length and whether it is set.
Min()(float64, bool)
Minimum numeric value and whether it is set.
Max()(float64, bool)
Maximum numeric value and whether it is set.
Step()(float64, bool)
Numeric editor step and whether it is set.
DatePickerAppearance()DatePickerAppearance
Configured date editor mode.
MinRows()int
Minimum authored rows for repeating fields.
MaxRows()int
Maximum authored rows for repeating fields.
RowLabel()string
Author-facing repeating-row label.
RowLabelComponent()(pluginKey, component string, config json.RawMessage, ok bool)
Detached paired-plugin row-label component selection and whether one was configured.
RowLabels()map[string]string
Translated repeating-row labels.
WithLabelTranslations()map[string]string
Defensive copy of authored label translations.
InitiallyCollapsed()bool
Initial collapsed state for supported layouts.
JoinCollection()string
Collection read through a join field.
JoinOn()string
Relationship path backing a join field.
JoinLimit()int
Maximum number of joined documents returned.
JoinDefaultColumns()[]string
Defensive copy of default join-list columns.
JoinDefaultSort()string
Default join-list ordering.
JoinAllowCreate()bool
Whether the admin may create a joined target inline.
ValueType()ValueType
Declared output type for a virtual field.
RelationshipFilters()[]RelationshipFilterRule
Defensive copy of server-enforced picker filters.
ReferenceDeleteAction()ReferenceDeleteAction
Authored delete policy; empty means config resolution must apply the default.
PluginConfig()json.RawMessage
Defensive copy of plugin-owned configuration JSON.
PluginReferenceKeys()[]string
Defensive copy of plugin-declared reference keys.
Issues()[]Issue
Defensive copy of builder issues found before config resolution.

Definitions defensively copy nested fields, blocks, tabs, plugin JSON, and option slices. Construct them with package builders rather than struct literals.

Read-only methods expose all builder input to config resolvers and plugins: labels, validation and index flags, defaults, choices, nested definitions, relationship metadata, presentation, scalar bounds, join metadata, plugin config, and reference keys.

Methods