Fields

Introduction

Fields define the input fields for a form builder. If using a stream model these are completely automated for you by default.

protected $fields = [
    'license'               => [
        'label'        => 'anomaly.module.installer::field.license.label',
        'instructions' => 'anomaly.module.installer::field.license.instructions',
        'wrapper_view' => 'anomaly.module.installer::field_type/license/wrapper',
        'type'         => 'anomaly.field_type.boolean',
        'required'     => true,
        'config'       => [
            'label'   => 'anomaly.module.installer::field.license.agree',
            'mode'    => 'checkbox',
        ],
    ],
];

Definition

Key Required Type Default Description
slug true string The field definition key. The field slug is used for naming the field input and identifying it amongst other fields.
label false string The field assignment label or field name if available. The input label.
instructions false string The field assignment instructions or field instructions. The input instructions.
warning false string The field assignment warning or field warning. The input warning.
placeholder false string The field assignment placeholder or field placeholder. The input placeholder.
type false string The field type. The namespace or slug of a field type to use.
field false string The streams field slug. The streams field slug to use for populating defaults.
required false boolean The required status of the field assignment. A shortcut boolean flag to add required to the rules array.
unique false boolean The unique status of the field assignment. A shortcut boolean flag to add unique to the rules array.
rules false array null An array of additional Laravel validation rules.
validators false array null An array of custom validators keyed by rule.
prefix false string The prefix of the form. The prefix helps when more than one form are displayed on a page.
disabled false boolean false Determines whether the field will be disabled or not.
enabled false boolean true Determines whether the field will be processed or not.
readonly false boolean false Determines whether the field will be read only or not.
hidden false boolean false Determines whether the field will be visibly hidden or not.
config false array null A config array for the field type.
attributes false array null An array of key => value HTML attributes.
Any base level definition keys starting with data- will be pushed into attributes automatically.
class false string Varies by field type. A class to append to the attributes.
input_view false string Varies by field type. A prefixed view to use for the input.
wrapper_view false string Varies by field type. A prefixed view to use for the field wrapper.