Methods

__construct()

__construct(null | int | string $name, array $options) 

Parameters

$name

nullintstring

Optional name for the element

$options

array

Optional options for the element

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Clear all label options

clearLabelOptions() : \Zend\Form\Element | \Zend\Form\ElementInterface

Retrieve a single element attribute

getAttribute($key) : mixed | null

Parameters

$key

Returns

mixednull

Retrieve all attributes at once

getAttributes() : array | \Traversable

Returns

array\Traversable

Retrieve the label used for this element

getLabel() : null | string

Returns

nullstring

Get the attributes to use with the label

getLabelAttributes() : array

Returns

array

Retrieve a single label option

getLabelOption($key) : mixed | null

Parameters

$key

Returns

mixednull

Get label specific options

getLabelOptions() : array

Returns

array

Get validation error messages, if any.

getMessages() : array | \Traversable

Returns a list of validation failure messages, if any.

Returns

array\Traversable

Get value for name

getName() : string | int

Returns

stringint

Return the specified option

getOption(string $option) : NULL | mixed

Parameters

$option

string

Returns

NULLmixed

Get defined options

getOptions() : array

Returns

array

Retrieve the element value

getValue() : mixed

Returns

mixed

Does the element has a specific attribute ?

hasAttribute(string $key) : bool

Parameters

$key

string

Returns

bool

Does the element has a specific label option ?

hasLabelOption(string $key) : bool

Parameters

$key

string

Returns

bool

This function is automatically called when creating element with factory.

init() : void

It allows to perform various operations (add elements...)

Remove a single attribute

removeAttribute(string $key) : \Zend\Form\ElementInterface

Parameters

$key

string

Returns

Remove many attributes at once

removeAttributes(array $keys) : \Zend\Form\ElementInterface

Parameters

$keys

array

Returns

Remove a single label option

removeLabelOption(string $key) : \Zend\Form\ElementInterface

Parameters

$key

string

Returns

Remove many attributes at once

removeLabelOptions(array $keys) : \Zend\Form\ElementInterface

Parameters

$keys

array

Returns

Set a single element attribute

setAttribute(string $key, mixed $value) : \Zend\Form\Element | \Zend\Form\ElementInterface

Parameters

$key

string

$value

mixed

Returns

Set many attributes at once

setAttributes(array | \Traversable $arrayOrTraversable) : \Zend\Form\Element | \Zend\Form\ElementInterface

Implementation will decide if this will overwrite or merge.

Parameters

$arrayOrTraversable

array\Traversable

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

Set the label used for this element

setLabel($label) : \Zend\Form\Element | \Zend\Form\ElementInterface

Set the attributes to use with the label

setLabelAttributes(array $labelAttributes) : \Zend\Form\Element | \Zend\Form\ElementInterface

Parameters

$labelAttributes

array

Returns

Set a single label optionn

setLabelOption(string $key, mixed $value) : \Zend\Form\Element | \Zend\Form\ElementInterface

Parameters

$key

string

$value

mixed

Returns

Set many label options at once

setLabelOptions(array | \Traversable $arrayOrTraversable) : \Zend\Form\Element | \Zend\Form\ElementInterface

Implementation will decide if this will overwrite or merge.

Parameters

$arrayOrTraversable

array\Traversable

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

Set a list of messages to report when validation fails

setMessages(array | \Traversable $messages) : \Zend\Form\Element | \Zend\Form\ElementInterface

Parameters

$messages

array\Traversable

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

Set value for name

setName(string $name) : \Zend\Form\Element | \Zend\Form\ElementInterface

In most cases, this will proxy to the attributes for storage, but is present to indicate that elements are generally named.

Parameters

$name

string

Returns

Set a single option for an element

setOption(string $key, mixed $value) : \Zend\Form\self

Parameters

$key

string

$value

mixed

Returns

\Zend\Form\self

Set options for an element.

setOptions(array | \Traversable $options) : \Zend\Form\Element | \Zend\Form\ElementInterface

Accepted options are: - label: label to associate with the element - label_attributes: attributes to use when the label is rendered - label_options: label specific options

Parameters

$options

array\Traversable

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

Set the element value

setValue(mixed $value) : \Zend\Form\Element

Parameters

$value

mixed

Returns

 Properties

 

$attributes

$attributes : array

 

$label

$label : null | string

 

$labelAttributes

$labelAttributes : array

 

Label specific options

$labelOptions : array

 

<p>Validation error messages</p>

$messages : array

 

<p>custom options</p>

$options : array

 

$value

$value : mixed