PHP Class Pop\Form\Element

Author: Nick Sagona, III ([email protected])
Inheritance: extends Pop\Dom\Child
Mostrar archivo Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Property Type Description
$allowedTypes array Form element allowed types
$errorDisplay array Form element error display format
$errors array Form element errors
$label string Form element label
$labelAttributes array Form element label attributes
$marked string | array Form element marked value(s)
$name string Element name
$required boolean Form element required property
$type string Element type
$validators array Form element validators
$value string | array Form element value(s)

Public Methods

Method Description
__construct ( string $type, string $name, string $value = null, string | array $marked = null, string $indent = null ) : Element Constructor
addValidator ( mixed $validator ) : Element Add a validator the form element object.
clearErrors ( ) : Element Clear errors.
getErrors ( ) : array Get form element object errors.
getLabel ( ) : string Get form element object label.
getLabelAttributes ( ) : array Get the attributes of the form element object label.
getMarked ( ) : mixed Get form element object marked values.
getName ( ) : string Get form element object name.
getType ( ) : string Get form element object type.
getValidators ( ) : array Get validators
getValue ( ) : mixed Get form element object value.
hasErrors ( ) : array Get if form element object has errors.
isCaptcha ( ) : boolean Get whether the form element object is a captcha element.
isCheckbox ( ) : boolean Get whether the form element object is a checkbox element.
isCsrf ( ) : boolean Get whether the form element object is a csrf element.
isMultiple ( ) : boolean Get whether the form element object can have multiple input values.
isRadio ( ) : boolean Get whether the form element object is a radio element.
isRequired ( ) : boolean Get whether the form element object is required.
isSelect ( ) : boolean Get whether the form element object is a select element.
isTextarea ( ) : boolean Get whether the form element object is a textarea element.
output ( ) : string Method to render the child and its child nodes.
render ( boolean $ret = false, integer $depth, string $indent = null, string $errorIndent = null ) : string Method to render the child and its child nodes.
setErrorDisplay ( string $container, array $attribs, boolean $pre = false ) : Element Set error display values
setErrorPost ( boolean $post = true ) : Element Set error post-display
setErrorPre ( boolean $pre = true ) : Element Set error pre-display
setLabel ( mixed $label ) : Element Set the label of the form element object.
setLabelAttributes ( array $attribs ) : Element Set the attributes of the label of the form element object.
setMarked ( mixed $marked ) : Element Set the marked value of the form element object.
setName ( string $name ) : Element Set the name of the form element object.
setRequired ( boolean $required ) : Element Set whether the form element object is required.
setValidators ( array $validators = [] ) : Element Set validators
setValue ( mixed $value ) : Element Set the value of the form element object.
validate ( ) : boolean Validate the form element object.

Method Details

__construct() public method

Instantiate the form element object
public __construct ( string $type, string $name, string $value = null, string | array $marked = null, string $indent = null ) : Element
$type string
$name string
$value string
$marked string | array
$indent string
return Element

addValidator() public method

Add a validator the form element object.
public addValidator ( mixed $validator ) : Element
$validator mixed
return Element

clearErrors() public method

Clear errors.
public clearErrors ( ) : Element
return Element

getErrors() public method

Get form element object errors.
public getErrors ( ) : array
return array

getLabel() public method

Get form element object label.
public getLabel ( ) : string
return string

getLabelAttributes() public method

Get the attributes of the form element object label.
public getLabelAttributes ( ) : array
return array

getMarked() public method

Get form element object marked values.
public getMarked ( ) : mixed
return mixed

getName() public method

Get form element object name.
public getName ( ) : string
return string

getType() public method

Get form element object type.
public getType ( ) : string
return string

getValidators() public method

Get validators
public getValidators ( ) : array
return array

getValue() public method

Get form element object value.
public getValue ( ) : mixed
return mixed

hasErrors() public method

Get if form element object has errors.
public hasErrors ( ) : array
return array

isCaptcha() public method

Get whether the form element object is a captcha element.
public isCaptcha ( ) : boolean
return boolean

isCheckbox() public method

Get whether the form element object is a checkbox element.
public isCheckbox ( ) : boolean
return boolean

isCsrf() public method

Get whether the form element object is a csrf element.
public isCsrf ( ) : boolean
return boolean

isMultiple() public method

Get whether the form element object can have multiple input values.
public isMultiple ( ) : boolean
return boolean

isRadio() public method

Get whether the form element object is a radio element.
public isRadio ( ) : boolean
return boolean

isRequired() public method

Get whether the form element object is required.
public isRequired ( ) : boolean
return boolean

isSelect() public method

Get whether the form element object is a select element.
public isSelect ( ) : boolean
return boolean

isTextarea() public method

Get whether the form element object is a textarea element.
public isTextarea ( ) : boolean
return boolean

output() public method

Method to render the child and its child nodes.
public output ( ) : string
return string

render() public method

Method to render the child and its child nodes.
public render ( boolean $ret = false, integer $depth, string $indent = null, string $errorIndent = null ) : string
$ret boolean
$depth integer
$indent string
$errorIndent string
return string

setErrorDisplay() public method

Set error display values
public setErrorDisplay ( string $container, array $attribs, boolean $pre = false ) : Element
$container string
$attribs array
$pre boolean
return Element

setErrorPost() public method

Set error post-display
public setErrorPost ( boolean $post = true ) : Element
$post boolean
return Element

setErrorPre() public method

Set error pre-display
public setErrorPre ( boolean $pre = true ) : Element
$pre boolean
return Element

setLabel() public method

Set the label of the form element object.
public setLabel ( mixed $label ) : Element
$label mixed
return Element

setLabelAttributes() public method

Set the attributes of the label of the form element object.
public setLabelAttributes ( array $attribs ) : Element
$attribs array
return Element

setMarked() public method

Set the marked value of the form element object.
public setMarked ( mixed $marked ) : Element
$marked mixed
return Element

setName() public method

Set the name of the form element object.
public setName ( string $name ) : Element
$name string
return Element

setRequired() public method

Set whether the form element object is required.
public setRequired ( boolean $required ) : Element
$required boolean
return Element

setValidators() public method

Set validators
public setValidators ( array $validators = [] ) : Element
$validators array
return Element

setValue() public method

Set the value of the form element object.
public setValue ( mixed $value ) : Element
$value mixed
return Element

validate() public method

Validate the form element object.
public validate ( ) : boolean
return boolean

Property Details

$allowedTypes protected_oe property

Form element allowed types
protected array $allowedTypes
return array

$errorDisplay protected_oe property

Form element error display format
protected array $errorDisplay
return array

$errors protected_oe property

Form element errors
protected array $errors
return array

$label protected_oe property

Form element label
protected string $label
return string

$labelAttributes protected_oe property

Form element label attributes
protected array $labelAttributes
return array

$marked protected_oe property

Form element marked value(s)
protected string|array $marked
return string | array

$name protected_oe property

Element name
protected string $name
return string

$required protected_oe property

Form element required property
protected bool $required
return boolean

$type protected_oe property

Element type
protected string $type
return string

$validators protected_oe property

Form element validators
protected array $validators
return array

$value protected_oe property

Form element value(s)
protected string|array $value
return string | array