Unified Field Schema V1 is the single Clean-Slate type system shared across all four OpenDash surfaces: Content & Term (Field Groups), Options (Site Global, Custom Options Pages, Theme Options), OwnerSettings (plugin settings_schema and theme functions.settings_schema), and StudioBlock (block.json). Legacy aliases (such as short_text, rich_text, image_ref, or choices) do not exist in V1.
All 25 Data Field Types + 3 UI-Only Layout Primitives
| Group | Type | JSON Value | Content/Term | Options | OwnerSettings | StudioBlock | Key Options & Limits |
|---|---|---|---|---|---|---|---|
| Basic | text | string | Yes | Yes | Yes | Yes | max_chars (default 512, max 2000), prepend, append |
| Basic | textarea | string | Yes | Yes | Yes | Yes | rows (2..=16), max_chars (default 4000, max 100,000) |
| Basic | number | number | Yes | Yes | Yes | Yes | Finite numeric; supports min, max, step, unit (Block) |
| Basic | range | number | Yes | Yes | Yes | Yes | Requires min & max; supports step, unit (Block) |
| Basic | email | string | Yes | Yes | Yes | Yes | Validated email syntax, max_chars <= 254 |
| Basic | url | string | Yes | Yes | Yes | Yes | Safe http(s)://, /path, #anchor, mailto:, tel: (<= 2048B) |
| Basic | secret | SecretStore ref | No | No | Yes | No | Write-only; default must be null; never exposed to templates |
| Content | richtext | Sanitized HTML | Yes | Yes | No | Yes | Max 32,768B output; toolbar: minimal | standard |
| Content | media | SHA-256 ID | Yes | Yes | Yes | Yes | media_kind (image|video|file|any); auto-pins media_refs |
| Content | gallery | string[] | Yes | Yes | No | Yes | Unique media IDs; min_items, max_items <= 50 |
| Content | link | {url,label,new_tab,nofollow} | Yes | Yes | No | Yes | Validated URL + label (<= 160 chars) |
| Choice | select | string | string[] | Yes | Yes | Yes | Yes | 1..=100 options (or options_source on Block), multiple, allow_null |
| Choice | checkbox | string[] | Yes | Yes | Yes | Yes | 1..=100 options, min_items, max_items, layout |
| Choice | radio_buttons | string | Yes | Yes | Yes | Yes | 1..=12 options, layout: buttons | radio, Block responsive/css_var |
| Choice | boolean | bool | Yes | Yes | Yes | Yes | Toggle switch with optional on_label / off_label |
| Visual | color | string | Yes | Yes | No | Yes | Hex (#RGB/#RRGGBB/#RRGGBBAA), transparent, currentColor, or --od-token-* |
| Visual | icon | string | Yes | Yes | No | Yes | Curated kebab key in CORE_ICONS |
| Date | date | YYYY-MM-DD | Yes | Yes | No | Yes | ISO-8601 date, min_date, max_date |
| Date | datetime | ISO-8601 UTC | Yes | Yes | No | Yes | Stored in UTC, formatted per Site Timezone |
| Date | time | HH:MM[:SS] | Yes | Yes | No | Yes | 24-hour clock format |
| Visual | spacing | {top,right,bottom,left} | No | Yes | No | Yes | property: padding | margin (allows negative margin -256..=256) |
| Relation | entry_ref | i64 | i64[] | Yes | Yes | No | Yes | target_types (or ["*"] in Block), max 50 items, locale-filtered |
| Relation | term_ref | i64 | i64[] | Yes | Yes | No | Yes | taxonomy (or taxonomy_from_field in Block), sync_entry_terms (Content) |
| Struct | group | Nested object | Yes | Yes | Yes | Yes | Non-empty child fields[]; up to depth 2 |
| Struct | repeater | Object array | Yes | Yes | No | Yes | 1 level max (flat fields or 1 flat group); max 50 items (32 in Block) |
| UI Layout | tab | Not stored | Yes | Yes | Yes | Yes | Visual tab separator (placement: top | left); keeps flat keys |
| UI Layout | accordion | Not stored | Yes | Yes | Yes | Yes | Collapsible form group (open_by_default, multi_expand, endpoint) |
| UI Layout | message | Not stored | Yes | Yes | Yes | Yes | Plain-text info/warning notice (no HTML) |
FieldSpec Rules & DNF Conditional Logic
- Keys & labels:
keymust match^[a-z][a-z0-9_]{0,63}$;labelis 1..=100 chars; optionalinstructions(<= 400),placeholder(<= 120),width(25/33/50/66/75/100). - Conditional logic (
conditions): Evaluated in Disjunctive Normal Form (outer array =OR, inner array =AND) over operatorseq,neq,empty,not_empty,contains,gt,lt,in. Hidden fields skiprequiredvalidation on save while preserving existing database values. - Context extensions:
Content&Termaddacl(min_view_role,min_edit_role,public_exposure),translatable,show_in_list, and schema-safedeclaration_state(declared | withdrawn);Optionsaddspublic&translatable;StudioBlockaddsresponsive,css_var(^--od-[a-z0-9-]{1,48}$),unit,options_source,taxonomy_from_field, and wildcardtarget_types: ["*"].
MiniJinja C-SEC Hydration Shapes
Templates receive uniformly hydrated objects (zero suffix variables like _url or _alt):
| Field Type | Hydrated Template Object |
|---|---|
media | { id, url, thumbnail_url, alt, width, height, kind } (or null) |
gallery | Array of hydrated media objects |
link | { url, label, target, rel, new_tab, nofollow } |
icon | { name } — pass to {{ od_icon(icon.name, "...") }} |
spacing | { top, right, bottom, left, css, classes } |
entry_ref | { id, type_key, title, slug, url, cover_url, excerpt } (published + public only) |
term_ref | { id, kind, name, slug, url, featured_image } |
richtext | Safe post-rendered HTML via nonce replacement (never apply |safe) |
V1 Limits & Explicit Out-of-Scope Boundaries
repeaternesting stops at 1 level (nested repeaters are out of scope for V1).groupnesting stops at 2 levels;flexible_contentis intentionally excluded in V1.- Max 64 data fields per Field Group/Options schema; max 32 top-level data fields, 48 leaf fields, and 64 KiB of
props.valuesper Studio block. - Schema compatibility rules (
COMPAT-1..4) forbid destructive type switches or hard-deleting populated fields; deprecated fields markdeclaration_state: withdrawnto preserve existing content and media pins.