ElementInterface
in
Form element interface
Tags
Table of Contents
Methods
- addValidator() : ElementInterface
- Add a validator the form element
- clearErrors() : ElementInterface
- Clear errors
- getErrors() : array<string|int, mixed>
- Get form element errors
- getLabel() : string|null
- Get form element label
- getLabelAttributes() : array<string|int, mixed>
- Get the attributes of the form element label
- getName() : string|null
- Get form element name
- getType() : string|null
- Get form element object type
- getValidators() : array<string|int, mixed>
- Get validators
- getValue() : mixed
- Get form element value
- hasErrors() : bool
- Get if form element has errors
- isButton() : bool
- Get whether the form element object is a button
- isDisabled() : bool
- Get whether the form element is disabled
- isErrorPre() : bool
- Determine if error to display before the element
- isReadonly() : bool
- Get whether the form element is readonly
- isRequired() : bool
- Get whether the form element is required
- resetValue() : ElementInterface
- Reset the value of the form element
- setDisabled() : mixed
- Set whether the form element is disabled
- setErrorPre() : ElementInterface
- Set error to display before the element
- setLabel() : ElementInterface
- Set the label of the form element
- setLabelAttributes() : ElementInterface
- Set the attributes of the label of the form element
- setName() : ElementInterface
- Set the name of the form element
- setReadonly() : mixed
- Set whether the form element is readonly
- setRequired() : mixed
- Set whether the form element is required
- setValidators() : ElementInterface
- Set validators
- setValue() : ElementInterface
- Set the value of the form element
- validate() : bool
- Validate the form element
- validateCallable() : void
- Validate the value by callable
- validateValue() : void
- Validate the value
Methods
addValidator()
Add a validator the form element
public
addValidator(mixed $validator) : ElementInterface
Parameters
- $validator : mixed
Return values
ElementInterfaceclearErrors()
Clear errors
public
clearErrors() : ElementInterface
Return values
ElementInterfacegetErrors()
Get form element errors
public
getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed>getLabel()
Get form element label
public
getLabel() : string|null
Return values
string|nullgetLabelAttributes()
Get the attributes of the form element label
public
getLabelAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getName()
Get form element name
public
getName() : string|null
Return values
string|nullgetType()
Get form element object type
public
getType() : string|null
Return values
string|nullgetValidators()
Get validators
public
getValidators() : array<string|int, mixed>
Return values
array<string|int, mixed>getValue()
Get form element value
public
getValue() : mixed
hasErrors()
Get if form element has errors
public
hasErrors() : bool
Return values
boolisButton()
Get whether the form element object is a button
public
isButton() : bool
Return values
boolisDisabled()
Get whether the form element is disabled
public
isDisabled() : bool
Return values
boolisErrorPre()
Determine if error to display before the element
public
isErrorPre() : bool
Return values
boolisReadonly()
Get whether the form element is readonly
public
isReadonly() : bool
Return values
boolisRequired()
Get whether the form element is required
public
isRequired() : bool
Return values
boolresetValue()
Reset the value of the form element
public
resetValue() : ElementInterface
Return values
ElementInterfacesetDisabled()
Set whether the form element is disabled
public
setDisabled(bool $disabled) : mixed
Parameters
- $disabled : bool
setErrorPre()
Set error to display before the element
public
setErrorPre(bool $pre) : ElementInterface
Parameters
- $pre : bool
Return values
ElementInterfacesetLabel()
Set the label of the form element
public
setLabel(string $label) : ElementInterface
Parameters
- $label : string
Return values
ElementInterfacesetLabelAttributes()
Set the attributes of the label of the form element
public
setLabelAttributes(array<string|int, mixed> $attribs) : ElementInterface
Parameters
- $attribs : array<string|int, mixed>
Return values
ElementInterfacesetName()
Set the name of the form element
public
setName(string $name) : ElementInterface
Parameters
- $name : string
Return values
ElementInterfacesetReadonly()
Set whether the form element is readonly
public
setReadonly(bool $readonly) : mixed
Parameters
- $readonly : bool
setRequired()
Set whether the form element is required
public
setRequired(bool $required[, string|null $requiredMessage = 'This field is required.' ]) : mixed
Parameters
- $required : bool
- $requiredMessage : string|null = 'This field is required.'
setValidators()
Set validators
public
setValidators([array<string|int, mixed> $validators = [] ]) : ElementInterface
Parameters
- $validators : array<string|int, mixed> = []
Return values
ElementInterfacesetValue()
Set the value of the form element
public
setValue(mixed $value) : ElementInterface
Parameters
- $value : mixed
Return values
ElementInterfacevalidate()
Validate the form element
public
validate([array<string|int, mixed> $formValues = [] ]) : bool
Parameters
- $formValues : array<string|int, mixed> = []
Return values
boolvalidateCallable()
Validate the value by callable
public
validateCallable(callable $validator, mixed $value[, array<string|int, mixed> $formValues = [] ]) : void
Parameters
- $validator : callable
- $value : mixed
- $formValues : array<string|int, mixed> = []
validateValue()
Validate the value
public
validateValue(mixed $value[, array<string|int, mixed> $formValues = [] ]) : void
Parameters
- $value : mixed
- $formValues : array<string|int, mixed> = []