API Documentation (v0.9.0-alpha)

Avolutions\View\Form

Provides methods to create HTML forms with or without an Entity context.

Methods

Method Visibility Description
__construct() public Creates a new Form instance. If an Entity is given the method loads the EntityConfiguration and EntityMapping automatically.
button() public Creates an HTML button element.
checkbox() public Creates an HTML input element of type checkbox.
close() public Close a form.
color() public Creates an HTML input element of type color.
date() public Creates an HTML input element of type date.
datetime() public Creates an HTML input element of type datetime-local.
email() public Creates an HTML input element of type email.
error() public Creates a div with validation error message for an input field.
file() public Creates an HTML input element of type file.
generate() public Generates a Form for all fields of the Entity, depending on the Mapping of the Entity.
hidden() public Creates an HTML input element of type hidden.
image() public Creates an HTML input element of type image.
input() public Creates an HTML input element.
inputFor() public Creates an HTML input element for the given Entity field depending on the Mapping of this field.
label() public Creates an HTML label element.
labelFor() public Creates an HTML label element for the given Entity field depending on the Mapping for this field.
month() public Creates an HTML input element of type month.
number() public Creates an HTML input element of type number.
open() public Opens a form.
password() public Creates an HTML input element of type password.
radio() public Creates an HTML input element of type radio.
range() public Creates an HTML input element of type range.
reset() public Creates an HTML input element of type reset.
search() public Creates an HTML input element of type search.
select() public Creates an HTML select element with the given options.
submit() public Creates an HTML input element of type submit.
tel() public Creates an HTML input element of type tel.
text() public Creates an HTML input element of type text.
textarea() public Creates an HTML textarea element.
time() public Creates an HTML input element of type time.
url() public Creates an HTML input element of type url.
week() public Creates an HTML input element of type week.

Method Details

__construct()

Creates a new Form instance. If an Entity is given the method loads the EntityConfiguration and EntityMapping automatically.

public __construct([Entity|null $Entity = null ][, array<string|int, mixed> $errors = [] ]) : mixed
Parameters

Entity|null $Entity (optional)
$Entity The Entity context of the form.

array<string|int, mixed> $errors (optional)
Validation error messages.

button()

Creates an HTML button element.

public button([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the button tag.

Return values
string Creates an HTML button element.
checkbox()

Creates an HTML input element of type checkbox.

public checkbox([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type checkbox.
close()

Close a form.

public close() : string
Return values
string Close a form.
color()

Creates an HTML input element of type color.

public color([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type color.
date()

Creates an HTML input element of type date.

public date([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type date.
datetime()

Creates an HTML input element of type datetime-local.

public datetime([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type datetime-local.
email()

Creates an HTML input element of type email.

public email([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type email.
error()

Creates a div with validation error message for an input field.

public error(array<string|int, mixed> $messages) : string
Parameters

array<string|int, mixed> $messages
The error messages to display.

Return values
string Creates a div with validation error message for an input field.
file()

Creates an HTML input element of type file.

public file([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type file.
generate()

Generates a Form for all fields of the Entity, depending on the Mapping of the Entity.

public generate([array<string|int, mixed> $formAttributes = [] ][, bool $submitButton = true ]) : string
Parameters

array<string|int, mixed> $formAttributes (optional)
The attributes for the opening form tag.

bool $submitButton (optional)
Indicates if a submit button should be generated automatically.

Return values
string Generates a Form for all fields of the Entity, depending on the Mapping of the Entity.
hidden()

Creates an HTML input element of type hidden.

public hidden([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type hidden.
image()

Creates an HTML input element of type image.

public image([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type image.
input()

Creates an HTML input element.

public input(string $type[, array<string|int, mixed> $attributes = [] ]) : string
Parameters

string $type
The type for the input tag.

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element.
inputFor()

Creates an HTML input element for the given Entity field depending on the Mapping of this field.

public inputFor(string $fieldName[, array<string|int, mixed> $attributes = [] ][, bool $showLabel = true ]) : string
Parameters

string $fieldName
The field of the Entity.

array<string|int, mixed> $attributes (optional)
The attributes for the input element.

bool $showLabel (optional)
Indicates if a label should be generated or not.

Return values
string Creates an HTML input element for the given Entity field depending on the Mapping of this field.
label()

Creates an HTML label element.

public label(string $text[, array<string|int, mixed> $attributes = [] ]) : string
Parameters

string $text
The text of the label element.

array<string|int, mixed> $attributes (optional)
The attributes for the label tag.

Return values
string Creates an HTML label element.
labelFor()

Creates an HTML label element for the given Entity field depending on the Mapping for this field.

public labelFor(string $fieldName) : string
Parameters

string $fieldName
The field of the Entity.

Return values
string Creates an HTML label element for the given Entity field depending on the Mapping for this field.
month()

Creates an HTML input element of type month.

public month([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type month.
number()

Creates an HTML input element of type number.

public number([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type number.
open()

Opens a form.

public open([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the form tag.

Return values
string Opens a form.
password()

Creates an HTML input element of type password.

public password([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type password.
radio()

Creates an HTML input element of type radio.

public radio([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type radio.
range()

Creates an HTML input element of type range.

public range([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type range.
reset()

Creates an HTML input element of type reset.

public reset([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type reset.

Creates an HTML input element of type search.

public search([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type search.
select()

Creates an HTML select element with the given options.

public select([array<string|int, mixed> $options = [] ][, array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $options (optional)
The options for the select list.

array<string|int, mixed> $attributes (optional)
The attributes for the select tag.

Return values
string Creates an HTML select element with the given options.
submit()

Creates an HTML input element of type submit.

public submit([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type submit.
tel()

Creates an HTML input element of type tel.

public tel([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type tel.
text()

Creates an HTML input element of type text.

public text([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type text.
textarea()

Creates an HTML textarea element.

public textarea([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the textarea tag.

Return values
string Creates an HTML textarea element.
time()

Creates an HTML input element of type time.

public time([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type time.
url()

Creates an HTML input element of type url.

public url([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type url.
week()

Creates an HTML input element of type week.

public week([array<string|int, mixed> $attributes = [] ]) : string
Parameters

array<string|int, mixed> $attributes (optional)
The attributes for the input tag.

Return values
string Creates an HTML input element of type week.