Fields
in package
Management of input fields.
Tags
Table of Contents
Constants
Properties
- $_fields : array<string|int, mixed>
Methods
- add() : void
- Add a field to this fields instance.
- addOption() : void
- Add a option to a field.
- getAll() : array<string|int, mixed>
- List all fields, sorted by their order.
Constants
CHECKBOX
public
mixed
CHECKBOX
= 9
DATE
public
mixed
DATE
= 3
public
mixed
EMAIL
= 7
NUMBER
public
mixed
NUMBER
= 6
PASSWORD
public
mixed
PASSWORD
= 4
RADIO
public
mixed
RADIO
= 8
SELECT
public
mixed
SELECT
= 5
TEXT
public
mixed
TEXT
= 1
TEXTAREA
public
mixed
TEXTAREA
= 2
Properties
$_fields
private
array<string|int, mixed>
$_fields
= []
Array of all the registered fields.
Methods
add()
Add a field to this fields instance.
public
add(string $key, int $type, string $label[, bool $required = false ][, string|array<string|int, mixed> $value = '' ][, string|null $placeholder = null ][, string|null $info = null ][, int|null $order = null ]) : void
Parameters
- $key : string
-
Unique name for the field item.
- $type : int
-
Field type.
- $label : string
-
The label for this field.
- $required : bool = false
-
Require user to fill this field.
- $value : string|array<string|int, mixed> = ''
-
Default value for this field.
- $placeholder : string|null = null
-
Field placeholder.
- $info : string|null = null
-
Field information.
- $order : int|null = null
-
Field order.
addOption()
Add a option to a field.
public
addOption(string $field, string $value, string $option) : void
Parameters
- $field : string
-
Add the option to this field.
- $value : string
-
Field value.
- $option : string
-
The option to display.
getAll()
List all fields, sorted by their order.
public
getAll() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of fields.