Skip to content

fields_getting started

Lorenzo Girardi edited this page Oct 14, 2019 · 7 revisions

Fields

Aeria fields are a beautiful way to input and output data from your website. You can put them in metaboxes, sections and settings pages: the way of creating them is always the same.

General options

While every type of field has its own specific settings, they all share a set of general options that can be set from configuration files:

  • "id"(Required) is the key that you can use to retrieve the field value.
  • "type"(Required) defines which field you want to use.
  • "label" defines the label of the input in the back-office.
  • "description" appears in the back-office and is used to give informations to the user about the field.
  • "defaultValue" defines a default value for the field.
  • "required" defines if the field is required.
  • "when" define a visibility condition for this field in relation to another field's value, accepts these required parameters:
    • "id" define the id of the related field,
    • "value" define the wanted value
  • "validators" defines how you want to check the validity of the field. You can specify multiple validators, in two ways:
    • By declaring an array of validators, like [isEmail, isLong]
    • By declaring a string containing piped validators, like "isEmail|isLong"
  • "size" sets the width of the field. By default, all fields expand to the full width of the container. You can change that by setting size to either:
    • "half",
    • "quarter",
    • "third",
    • "twoThirds",
    • "threeQuarters"

....

Discover more on Aeria Fields