Skip to main content

Module field

Module field 

Source
Expand description

The open field-type registry: the framework and plugins add form field types.

A field descriptor (crate::form::FormField) is serde data (name, label, type key, options, rules); a field type is behaviour keyed by that type. Rendering splits so an override can present the same data the built-in does: FieldType::view_model builds a serde FieldVm, FieldType::render_default is the Askama presenter over it, and an OverrideResolver (default NoOverrides) may swap in a runtime template. Load/parse/save/assets/action join as defaulted methods when a type first needs them (backward-compatible).

Structs§

Adornment
A control placed beside the input (a copy button, a currency symbol): data in the view-model, never HTML, so an override re-presents it. The text template renders it into the input group.
FieldCx
The resolved per-field state a field type renders from.
FieldTypeReg
A field type a module contributes, so a form can offer an input the framework has no built-in for (a colour picker, a money amount, a map point).
FieldVm
The serialisable payload both the built-in template and an override render, so an override never re-derives data. data is per-type data, never HTML.
NoOverrides
The default resolver: no overrides, so the compiled path always runs at zero cost. The theme layer injects a real resolver when it is built.
OptionsError
A field type failed to type its options blob at boot.
OverrideError
A runtime override failed to render.
OverrideScope
Where a render is happening, for override resolution (most-specific first: resource.field then view_key then the compiled default).
ResolvedOptions
Per-type options, resolved once at boot from the descriptor’s options blob into a typed value cached for rendering (the text field resolves its input variant, select its option list; textarea carries none).
SubmittedField
A field type: behaviour registered once per string key. What a field sees of the submission when it produces its stored value.

Enums§

Chrome
Whether the framework wraps a field in standard chrome (label, required marker, error list) or the type renders bare (a hidden field, a heading).
FieldValue
A field’s value, general enough for scalar and (later) structured types. Serde so it rides in the view-model and a failed-validation re-render.
Placement
Where an adornment sits relative to the input.
RepeaterDisplay
How a repeater’s rows are laid out.
Surface
The surface being rendered, for override resolution.

Constants§

REPEATER_LIST_PAST
Past this many fields a row, a repeater with no stated display is a list.
SELECT_SEARCH_PAST
A dropdown turns searchable past this many choices.

Traits§

FieldType
InputType
An input variant of the text field: its HTML type, the rules it contributes, and how it parameterises the one text control (extra attributes, adjacent adornments). The extension point a plugin builds on (a currency input, say) instead of reimplementing a field. An input parameterises the single text control; anything needing different control markup is a FieldType.
OverrideResolver
The seam a theme/CMS layer backs with a runtime template engine (MiniJinja) to let users override a field’s presentation from outside the plugin. laterite-admin stays engine-agnostic; the default is NoOverrides.

Type Aliases§

FieldRegistry
The field-type registry: type key to behaviour, built once at boot.
InputRegistry
The registry the text field resolves its input option against.