pub struct ExtensionField {
pub name: String,
pub label: String,
pub kind: ExtensionFieldKind,
pub value: String,
pub help: String,
pub max_length: Option<u32>,
}Expand description
Form-field metadata returned by PageTypeHandler::extension_fields.
The admin’s page-edit form renders one input per entry under the
“Content” section so authors can write into the type’s extension
table without leaving the editor.
Kept stable for back-compat with v0.x handler authors. Internally
the admin converts to the richer crate::Widget before
rendering — new handlers can also return Widgets directly via
Self::from_widget for access to the full widget set (Date,
Color, Choice, …).
Fields§
§name: StringHTML form name — also the key on the form submission. Used
by PageTypeHandler::save_extension to pull the value back
out of the posted form.
label: StringDisplay label for the input.
kind: ExtensionFieldKindRender hint — picks which widget the admin draws.
value: StringPre-fill value (the current row’s value, when editing).
help: StringOptional helptext shown below the input.
max_length: Option<u32>Optional max length (string/text inputs only).
Implementations§
Source§impl ExtensionField
impl ExtensionField
Sourcepub fn into_widget(self) -> Widget
pub fn into_widget(self) -> Widget
Convert into a crate::Widget — the unified widget
descriptor the admin renderer + the stream-block editor both
consume. options is left empty (the admin handler
populates it for MediaPicker widgets from the media
library).
Sourcepub fn from_widget(w: Widget) -> Self
pub fn from_widget(w: Widget) -> Self
Wrap a crate::Widget back into the legacy
ExtensionField shape — useful for handlers that author
against the richer widget set but still want to return the
legacy Vec<ExtensionField>.
max_length, value, help, label, name are preserved.
Widget kinds outside the legacy set
(ExtensionFieldKind’s six variants) downgrade to
ExtensionFieldKind::Text — handlers that need the full
set should switch to returning Vec<Widget> (a follow-up
trait method lands with the stream-block slice).
Trait Implementations§
Source§impl Clone for ExtensionField
impl Clone for ExtensionField
Source§impl Debug for ExtensionField
impl Debug for ExtensionField
Source§impl<'de> Deserialize<'de> for ExtensionField
impl<'de> Deserialize<'de> for ExtensionField
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Forget for ExtensionField
impl Freeze for ExtensionField
impl RefUnwindSafe for ExtensionField
impl Send for ExtensionField
impl Sync for ExtensionField
impl Unpin for ExtensionField
impl UnsafeUnpin for ExtensionField
impl UnwindSafe for ExtensionField
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more