Skip to main content

Module widget

Module widget 

Source
Expand description

Widget descriptors — the single primitive both flat extension fields (crate::page_type::ExtensionField) and stream-block fields (crate::block::BlockField::Widget, landing in a later slice) use to describe one form input.

§Why one shared primitive

A custom input should not need a stack of parallel artifacts (server class, client class, adapter, template, CSS, media manifest) wired together by string-keyed names that fail at runtime.

Here a widget is one Tera template + one WidgetKind enum variant (or one inventory registration for custom widgets — see register_widget!). Every widget is server-rendered; the only client JS the admin ships is generic add/remove/reorder for stream lists and doesn’t know what a widget is.

§Surface

  • WidgetKind enumerates every built-in input type. New kinds only show up here; templates pick them up automatically.
  • Widget carries (kind, name, label, value, options, …) — the runtime metadata for one rendered input.
  • registry holds the inventory plumbing for third-party custom widgets that ship outside this crate.

Modules§

registry
Third-party custom widget registry.

Structs§

Widget
Runtime descriptor for one rendered form input. Built by PageTypeHandler::extension_fields (and, in a later slice, by Block::fields → BlockField::Widget) and consumed by the _widget.html Tera macro.

Enums§

WidgetKind
Which form input to draw. Templates dispatch on this variant via the bundled rcms_admin/_widget.html Tera macro.