738. Class

738.1. Zend\Form\Element

738.1.1. Methods

738.1.1.1. __construct

__construct()

@param null|int|string $name Optional name for the element

Parameters:array – Optional options for the element
Throws ExceptionInvalidArgumentException:
 

738.1.1.2. init

init()

This function is automatically called when creating element with factory. It allows to perform various operations (add elements...)

Return type:void

738.1.1.3. setName

setName()

Set value for name

Parameters:string
Return type:Element|ElementInterface

738.1.1.4. getName

getName()

Get value for name

Return type:string|int

738.1.1.5. setOptions

setOptions()

Set options for an element. Accepted options are: - label: label to associate with the element - label_attributes: attributes to use when the label is rendered

Parameters:array|Traversable
Return type:Element|ElementInterface
Throws :ExceptionInvalidArgumentException

738.1.1.6. getOptions

getOptions()

Get defined options

Return type:array

738.1.1.7. getOption

getOption()

Return the specified option

Parameters:string
Return type:NULL|mixed

738.1.1.8. setAttribute

setAttribute()

Set a single element attribute

Parameters:
  • string
  • mixed
Return type:

Element|ElementInterface

738.1.1.9. getAttribute

getAttribute()

Retrieve a single element attribute

Parameters:$key
Return type:mixed|null

738.1.1.10. removeAttribute

removeAttribute()

Remove a single attribute

Parameters:string
Return type:ElementInterface

738.1.1.11. hasAttribute

hasAttribute()

Does the element has a specific attribute ?

Parameters:string
Return type:bool

738.1.1.12. setAttributes

setAttributes()

Set many attributes at once

Implementation will decide if this will overwrite or merge.

Parameters:array|Traversable
Return type:Element|ElementInterface
Throws :ExceptionInvalidArgumentException

738.1.1.13. getAttributes

getAttributes()

Retrieve all attributes at once

Return type:array|Traversable

738.1.1.14. removeAttributes

removeAttributes()

Remove many attributes at once

Parameters:array
Return type:ElementInterface

738.1.1.15. clearAttributes

clearAttributes()

Clear all attributes

Return type:Element|ElementInterface

738.1.1.16. setValue

setValue()

Set the element value

Parameters:mixed
Return type:Element

738.1.1.17. getValue

getValue()

Retrieve the element value

Return type:mixed

738.1.1.18. setLabel

setLabel()

Set the label used for this element

Parameters:$label
Return type:Element|ElementInterface

738.1.1.19. getLabel

getLabel()

Retrieve the label used for this element

Return type:string

738.1.1.20. setLabelAttributes

setLabelAttributes()

Set the attributes to use with the label

Parameters:array
Return type:Element|ElementInterface

738.1.1.21. getLabelAttributes

getLabelAttributes()

Get the attributes to use with the label

Return type:array

738.1.1.22. setMessages

setMessages()

Set a list of messages to report when validation fails

Parameters:array|Traversable
Return type:Element|ElementInterface
Throws :ExceptionInvalidArgumentException

738.1.1.23. getMessages

getMessages()

Get validation error messages, if any.

Returns a list of validation failure messages, if any.

Return type:array|Traversable