category Zend
package Zend_Form

 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

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() : string

Returns

string

Get the attributes to use with the label

getLabelAttributes() : 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

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 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 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

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 : string

 

$labelAttributes

$labelAttributes : array

 

<p>Validation error messages</p>

$messages : array

 

<p>custom options</p>

$options : array

 

$value

$value : mixed