Skip to main content

FieldKind

Enum FieldKind 

Source
pub enum FieldKind {
Show 27 variants Text, Textarea, Password, Number, Decimal(&'static str), Checkbox, Select(&'static [(&'static str, &'static str)]), Lookup, Date, DateTime, Email, Url, Radio(&'static [(&'static str, &'static str)]), Color, Image, File, Link, Wysiwyg, PostObject, Relationship, Taxonomy, User, Repeater(&'static [Field]), Group(&'static [Field]), FlexibleContent(&'static [Block]), Gallery, Clone(&'static [Field]),
}
Expand description

The kind of input a form field renders as, and how its value is read.

Variants§

§

Text

A single line of text.

§

Textarea

Several lines of text.

§

Password

A password. The form never shows the stored value.

§

Number

A whole number, submitted as text. A resource’s integer field is checked as a whole number. A profile field accepts decimals as well (see Field::check_number).

§

Decimal(&'static str)

A decimal number, submitted as text, such as 9.5. The string is the browser’s step for the input: "any" accepts every value, and "0.01" steps by cents.

§

Checkbox

A yes/no value. Read it with FormInput::checkbox.

§

Select(&'static [(&'static str, &'static str)])

One choice from a list of (value, label) pairs.

§

Lookup

One choice from options that the resource loads from the database each time its form is shown, such as the rows of a related table. See IgniteResource::options.

§

Date

A calendar date, as YYYY-MM-DD.

§

DateTime

A date and time, as YYYY-MM-DDTHH:MM, with seconds when given.

§

Email

An email address, as Filament’s TextInput::make()->email(). The value must be a valid address, as the browser’s type="email" input defines one (see Field::check_email).

§

Url

A URL, as Filament’s TextInput::make()->url(). The value must parse as an absolute URL (see Field::check_url).

§

Radio(&'static [(&'static str, &'static str)])

One choice from a list of (value, label) pairs, shown as radio buttons, as Filament’s Radio. The value is checked as a Select is.

§

Color

A color, as Filament’s ColorPicker. The value is #rrggbb, stored in lowercase (see Field::check_color).

§

Image

An image from the media library, as Filament’s FileUpload::make()->image(). The value is the item’s id, a positive whole number, stored as text. The panel shows the item through the app’s MediaLibrary, when one is registered.

§

File

A file from the media library, as Filament’s FileUpload. Stored as Image is.

A link (ACF’s link field): the JSON text {"url": ..., "title": ..., "target": ...}. The URL is required and must parse; target is "" or "_blank" (see Field::check_link).

§

Wysiwyg

Rich text, as Filament’s RichEditor. The panel renders a textarea marked with data-ignite-editor, and loads the editor script the app registers with register_editor. Ignite bundles no editor. The value is the submitted HTML, unchanged.

§

PostObject

One post, chosen from options loaded each time the form is shown, as a Lookup is (ACF’s post object field).

§

Relationship

Several choices from options loaded each time the form is shown (ACF’s relationship field): the multi-value PostObject. The value is a JSON array of the chosen option values, as strings, such as ["12","40"].

§

Taxonomy

One taxonomy term, chosen from loaded options, as a Lookup is.

§

User

One user, chosen from loaded options, as a Lookup is.

§

Repeater(&'static [Field])

Rows of the given sub-fields, as Filament’s Repeater. The value is a JSON array with one object per row, keyed by sub-field name, such as [{"title": "One"}, {"title": "Two"}]. Each row is checked against the sub-fields.

§

Group(&'static [Field])

The given sub-fields, kept together (ACF’s group field). The value is one JSON object keyed by sub-field name.

§

FlexibleContent(&'static [Block])

Rows that each take one of the given blocks, as Filament’s Builder. The value is a JSON array of {"type": <block name>, "data": {<sub-field values>}} objects, as Filament stores a builder.

§

Gallery

Several images from the media library (ACF’s gallery field). The value is a JSON array of item ids, such as [3,8].

§

Clone(&'static [Field])

The fields of another field group, reused (ACF’s clone field). Ignite has no field groups of its own: the app resolves the group it clones and passes its fields here. The value is stored and checked as a Group of those fields is.

Implementations§

Source§

impl FieldKind

Source

pub fn loads_options(&self) -> bool

Whether the field’s choices are loaded each time its form is shown, through IgniteResource::options or RuntimeData::options: a lookup, post object, relationship, taxonomy or user field.

Trait Implementations§

Source§

impl Clone for FieldKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FieldKind

Source§

impl Debug for FieldKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FieldKind

Source§

impl From<FieldKind> for FieldKindDef

Source§

fn from(kind: FieldKind) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for FieldKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FieldKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more