Class Select

Summary

Fully Qualified Name: Zend\Form\Element\Select
Extends: Element
Implements: InputProviderInterface

Description

Methods

Name Description Defined By
__construct() Element
clearAttributes() Clear all attributes Element
clearLabelOptions() Clear all label options Element
disableInArrayValidator() Get the disable in array validator flag. Select
getAttribute() Retrieve a single element attribute Element
getAttributes() Retrieve all attributes at once Element
getEmptyOption() Return the string for the empty option (null if none) Select
getInputSpecification() Provide default input rules for this element Select
getLabel() Retrieve the label used for this element Element
getLabelAttributes() Get the attributes to use with the label Element
getLabelOption() Retrieve a single label option Element
getLabelOptions() Get label specific options Element
getMessages() Get validation error messages, if any. Element
getName() Get value for name Element
getOption() Return the specified option Element
getOptions() Get defined options Element
getUnselectedValue() Get the value when the select is not selected Select
getValue() Retrieve the element value Element
getValueOptions() Select
hasAttribute() Does the element has a specific attribute ? Element
hasLabelOption() Does the element has a specific label option ? Element
init() This function is automatically called when creating element with factory. It allows to perform various operations (add elements. Element
isMultiple() Element has the multiple attribute Select
removeAttribute() Remove a single attribute Element
removeAttributes() Remove many attributes at once Element
removeLabelOption() Remove a single label option Element
removeLabelOptions() Remove many attributes at once Element
setAttribute() Set a single element attribute Select
setAttributes() Set many attributes at once Element
setDisableInArrayValidator() Set the flag to allow for disabling the automatic addition of an InArray validator. Select
setEmptyOption() Set the string for an empty option (can be empty string). If set to null, no option will be added Select
setLabel() Set the label used for this element Element
setLabelAttributes() Set the attributes to use with the label Element
setLabelOption() Set a single label optionn Element
setLabelOptions() Set many label options at once Element
setMessages() Set a list of messages to report when validation fails Element
setName() Set value for name Element
setOption() Set a single option for an element Element
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 - value_options: list of values and labels for the select options - empty_option: should an empty option be prepended to the options ? Select
setUnselectedValue() Set the value if the select is not selected Select
setUseHiddenElement() Do we render hidden element? Select
setValue() Set the element value Element
setValueOptions() Select
unsetValueOption() Select
useHiddenElement() Do we render hidden element? Select

Method Details

__construct()

Parameter Name Type Description
$name null|int|string Optional
$options array Optional

Returns:

clearAttributes()

Clear all attributes

Returns: \Element|\ElementInterface

clearLabelOptions()

Clear all label options

Returns: \Element|\ElementInterface

disableInArrayValidator()

Get the disable in array validator flag.

Returns: bool

getAttribute()

Retrieve a single element attribute

Parameter Name Type Description
$key
$key

Returns: mixed|null

getAttributes()

Retrieve all attributes at once

Returns: array|\Traversable

getEmptyOption()

Return the string for the empty option (null if none)

Returns: string|null

getInputSpecification()

Provide default input rules for this element

Returns: array

getLabel()

Retrieve the label used for this element

Returns: null|string

getLabelAttributes()

Get the attributes to use with the label

Returns: array

getLabelOption()

Retrieve a single label option

Parameter Name Type Description
$key
$key

Returns: mixed|null

getLabelOptions()

Get label specific options

Returns: array

getMessages()

Get validation error messages, if any.

Returns a list of validation failure messages, if any.

Returns: array|\Traversable

getName()

Get value for name

Returns: string|int

getOption()

Return the specified option

Parameter Name Type Description
$option string

Returns: null|mixed

getOptions()

Get defined options

Returns: array

getUnselectedValue()

Get the value when the select is not selected

Returns: string

getValue()

Retrieve the element value

Returns: mixed

getValueOptions()

Returns: array

hasAttribute()

Does the element has a specific attribute ?

Parameter Name Type Description
$key string

Returns: bool

hasLabelOption()

Does the element has a specific label option ?

Parameter Name Type Description
$key string

Returns: bool

init()

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

..)

Returns: void

isMultiple()

Element has the multiple attribute

Returns: bool

removeAttribute()

Remove a single attribute

Parameter Name Type Description
$key string

Returns: \ElementInterface

removeAttributes()

Remove many attributes at once

Parameter Name Type Description
$keys array

Returns: \ElementInterface

removeLabelOption()

Remove a single label option

Parameter Name Type Description
$key string

Returns: \ElementInterface

removeLabelOptions()

Remove many attributes at once

Parameter Name Type Description
$keys array

Returns: \ElementInterface

setAttribute()

Set a single element attribute

Parameter Name Type Description
$key string
$value mixed

Returns: \Select|\ElementInterface

setAttributes()

Set many attributes at once

Implementation will decide if this will overwrite or merge.

Parameter Name Type Description
$arrayOrTraversable array|\Traversable

Returns: \Element|\ElementInterface

setDisableInArrayValidator()

Set the flag to allow for disabling the automatic addition of an InArray validator.

Parameter Name Type Description
$disableOption bool

Returns: \Select

setEmptyOption()

Set the string for an empty option (can be empty string). If set to null, no option will be added

Parameter Name Type Description
$emptyOption string|null

Returns: \Select

setLabel()

Set the label used for this element

Parameter Name Type Description
$label
$label

Returns: \Element|\ElementInterface

setLabelAttributes()

Set the attributes to use with the label

Parameter Name Type Description
$labelAttributes array

Returns: \Element|\ElementInterface

setLabelOption()

Set a single label optionn

Parameter Name Type Description
$key string
$value mixed

Returns: \Element|\ElementInterface

setLabelOptions()

Set many label options at once

Implementation will decide if this will overwrite or merge.

Parameter Name Type Description
$arrayOrTraversable array|\Traversable

Returns: \Element|\ElementInterface

setMessages()

Set a list of messages to report when validation fails

Parameter Name Type Description
$messages array|\Traversable

Returns: \Element|\ElementInterface

setName()

Set value for name

Parameter Name Type Description
$name string

Returns: \Element|\ElementInterface

setOption()

Set a single option for an element

Parameter Name Type Description
$key string
$value mixed

Returns: self

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 - value_options: list of values and labels for the select options - empty_option: should an empty option be prepended to the options ?

Parameter Name Type Description
$options array|\Traversable

Returns: \Select|\ElementInterface

setUnselectedValue()

Set the value if the select is not selected

Parameter Name Type Description
$unselectedValue string

Returns: \Select

setUseHiddenElement()

Do we render hidden element?

Parameter Name Type Description
$useHiddenElement bool

Returns: \Select

setValue()

Set the element value

Parameter Name Type Description
$value mixed

Returns: \Element

setValueOptions()

Parameter Name Type Description
$options array

Returns: \Select

unsetValueOption()

Parameter Name Type Description
$key string

Returns: self

useHiddenElement()

Do we render hidden element?

Returns: bool

Top