Form
extends Tag
in package
Manage forms elements based on models relation et fields types
Table of Contents
- $excludes : array<string|int, mixed>
- List of fields to exclude
- $relations : array<string|int, mixed>
- Model relations
- $types : array<string|int, mixed>
- Fields types with options
- getDisplayValue() : mixed
- Get display data of a field from a Resultset
- getFields() : void
- Includes all fields elements partial based on model
- getLabel() : string
- Get field label
- getTag() : string
- Get field element tag from model
Properties
$excludes
List of fields to exclude
public
static array<string|int, mixed>
$excludes
= ['id', 'created_at', 'updated_at']
$relations
Model relations
public
static array<string|int, mixed>
$relations
= []
$types
Fields types with options
private
static array<string|int, mixed>
$types
= ['phone' => ['pattern' => '\\(?([0-9]{3})\\)?([ .-]?)([0-9]{3})\\2([0-9]{4})'], 'password' => ['rel' => 'password'], 'email' => '', 'postal_code' => ['pattern' => '^(([0-8][0-9])|(9[0-5]))[0-9]{3}$']]
Methods
getDisplayValue()
Get display data of a field from a Resultset
public
static getDisplayValue(mixed $row, string $model, string $id) : mixed
Parameters
- $row : mixed
-
Resultset of the query
- $model : string
-
Model name
- $id : string
-
Name of the field
Return values
mixed —Value to display
getFields()
Includes all fields elements partial based on model
public
static getFields(string $model[, null|array<string|int, mixed> $excludes = [] ]) : void
Parameters
- $model : string
-
Model name
- $excludes : null|array<string|int, mixed> = []
Return values
void —getLabel()
Get field label
public
static getLabel( $name) : string
Parameters
Return values
string —Label to display
getTag()
Get field element tag from model
public
static getTag(string $name, array<string|int, mixed> $options[, null|bool $restrictable = true ]) : string
Parameters
- $name : string
-
Name of the field
- $options : array<string|int, mixed>
-
Options of the field
- $restrictable : null|bool = true
Return values
string —Html tag of the field