Form implements IErrorable
Class Form
Table of Contents
Interfaces
- IErrorable
- Interface IErrorable
Methods
- add() : $this
- Add field to form.
- addClass() : void
- addDataAttribute() : void
- addFieldAfter() : void
- Add field after target field.
- addFieldBefore() : void
- Add field before target field.
- getAction() : string
- Action url where to ubmit form.
- getClass() : array<string|int, mixed>
- getDataAttributes() : array<string|int, mixed>
- getErrors() : array<string|int, Error>
- Get Errors collections.
- getField() : Base|null
- getFields() : array<string|int, Base>
- getId() : string
- getMethod() : string
- getName() : string
- getPostfix() : string
- getPrefix() : string
- render() : void
- Collect all elements.
- setAction() : $this
- setClass() : void
- setDataAttributes() : $this
- setId() : void
- setMethod() : $this
- setName() : void
- setPostfix() : Form
- setPrefix() : $this
Methods
add()
Add field to form.
public
add(Base|mixed $field) : $this
Parameters
- $field : Base|mixed
-
Field to add.
Return values
$thisaddClass()
public
addClass(string $className) : void
Parameters
- $className : string
-
String to add as class name of form.
addDataAttribute()
public
addDataAttribute(string $key[, string $value = '' ]) : void
Parameters
- $key : string
-
Key for add data attribute. ('role').
- $value : string = ''
-
Value for add data attribute. ('remove button').
addFieldAfter()
Add field after target field.
public
addFieldAfter(Base $newField, Base $targetField) : void
Parameters
addFieldBefore()
Add field before target field.
public
addFieldBefore(Base $newField, Base $targetField) : void
Parameters
getAction()
Action url where to ubmit form.
public
getAction() : string
Return values
stringgetClass()
public
getClass() : array<string|int, mixed>
Return values
array<string|int, mixed>getDataAttributes()
public
getDataAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getErrors()
Get Errors collections.
public
getErrors() : array<string|int, Error>
Return values
array<string|int, Error>getField()
public
getField(string $key) : Base|null
Parameters
- $key : string
-
Unique key.
Return values
Base|nullgetFields()
public
getFields() : array<string|int, Base>
Return values
array<string|int, Base>getId()
public
getId() : string
Return values
stringgetMethod()
public
getMethod() : string
Return values
stringgetName()
public
getName() : string
Return values
stringgetPostfix()
public
getPostfix() : string
Return values
stringgetPrefix()
public
getPrefix() : string
Return values
stringrender()
Collect all elements.
public
render() : void
Print form html.
setAction()
public
setAction(string $action) : $this
Parameters
- $action : string
-
Url where to send form on submit.
Return values
$thissetClass()
public
setClass(array<string|int, mixed> $class) : void
Parameters
- $class : array<string|int, mixed>
-
Array of strings to set as class names.
setDataAttributes()
public
setDataAttributes(array<string|int, mixed> $dataAttributes) : $this
Parameters
- $dataAttributes : array<string|int, mixed>
-
Data attributes key value pair array.
Return values
$thissetId()
public
setId(string $id) : void
Parameters
- $id : string
-
Id value.
setMethod()
public
setMethod(string $method) : $this
Parameters
- $method : string
-
Get or post.
Return values
$thissetName()
public
setName(string $name) : void
Parameters
- $name : string
-
Name value.
setPostfix()
public
setPostfix(string $postfix) : Form
Parameters
- $postfix : string
-
String to set as postfix fo form.
Return values
FormsetPrefix()
public
setPrefix(string $prefix) : $this
Parameters
- $prefix : string
-
String to set as prefix of form.