View/Helper/FormSelect.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_View
- Subpackage
- Helper
- Version
- $Id: FormSelect.php 25187 2013-01-08 08:21:00Z frosch $
\Zend_View_Helper_FormSelect
Helper to generate "select" list of options
Extend this, don't use it on its own.
- Parent(s)
- \Zend_View_Helper_FormElement < \Zend_View_Helper_HtmlElement < \Zend_View_Helper_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants

EOL
= "\n"
EOL character
Inherited from: \Zend_View_Helper_HtmlElement::EOL\Zend_View_Helper_FormElement::EOL- Inherited_from
- \Zend_View_Helper_HtmlElement::EOL
- Inherited_from
- \Zend_View_Helper_FormElement::EOL
Properties


string $_closingBracket = null
The tag closing bracket
Inherited from: \Zend_View_Helper_HtmlElement::$$_closingBracket\Zend_View_Helper_FormElement::$$_closingBracketnull
Details- Type
- string
- Inherited_from
- \Zend_View_Helper_HtmlElement::$$_closingBracket
- Inherited_from
- \Zend_View_Helper_FormElement::$$_closingBracket


\Zend_Translate_Adapter|null $_translator =
- Type
- \Zend_Translate_Adapter | null
- Inherited_from
- \Zend_View_Helper_FormElement::$$_translator


\Zend_View_Interface $view = null
View object
Inherited from: \Zend_View_Helper_Abstract::$$view\Zend_View_Helper_HtmlElement::$$view\Zend_View_Helper_FormElement::$$viewnull
Details- Type
- \Zend_View_Interface
- Inherited_from
- \Zend_View_Helper_Abstract::$$view
- Inherited_from
- \Zend_View_Helper_HtmlElement::$$view
- Inherited_from
- \Zend_View_Helper_FormElement::$$view
Methods


_build(string $value, string $label, array $selected, array | bool $disable, array $optionClasses = array()) : string
Builds the actual
Name | Type | Description |
---|---|---|
$value | string | Options Value |
$label | string | Options Label |
$selected | array | The option value(s) to mark as 'selected' |
$disable | array | bool | Whether the select is disabled, or individual options are |
$optionClasses | array | The classes to associate with each option value |
Type | Description |
---|---|
string | Option Tag XHTML |


_getInfo( $name, $value = null, $attribs = null, $options = null, $listsep = null) : array
Converts parameter arguments to an element info array.
Inherited from: \Zend_View_Helper_FormElement::_getInfo()E.g, formExample($name, $value, $attribs, $options, $listsep) is the same thing as formExample(array('name' => ...)).
Note that you cannot pass a 'disable' param; you need to pass it as an 'attribs' key.
Name | Type | Description |
---|---|---|
$name | ||
$value | ||
$attribs | ||
$options | ||
$listsep |
Type | Description |
---|---|
array | An element info array with keys for name, value, attribs, options, listsep, disable, and escape. |
- Access
- protected


_hidden(string $name, string $value = null, array $attribs = null) : string
We have this as a common method because other elements often need hidden elements for their operation.
Name | Type | Description |
---|---|---|
$name | string | The element name. |
$value | string | The element value. |
$attribs | array | Attributes for the element. |
Type | Description |
---|---|
string | A hidden element. |
- Access
- protected


_htmlAttribs(array $attribs) : string
Converts an associative array to a string of tag attributes.
Inherited from: \Zend_View_Helper_HtmlElement::_htmlAttribs()\Zend_View_Helper_FormElement::_htmlAttribs()Name | Type | Description |
---|---|---|
$attribs | array | From this array, each key-value pair is converted to an attribute name and value. |
Type | Description |
---|---|
string | The XHTML for the attributes. |
- Access
- public


_isStrictDoctype() : boolean
Is doctype strict?
Inherited from: \Zend_View_Helper_HtmlElement::_isStrictDoctype()\Zend_View_Helper_FormElement::_isStrictDoctype()Type | Description |
---|---|
boolean |


_isXhtml() : boolean
Is doctype XHTML?
Inherited from: \Zend_View_Helper_HtmlElement::_isXhtml()\Zend_View_Helper_FormElement::_isXhtml()Type | Description |
---|---|
boolean |


_normalizeId(string $value) : string
Normalize an ID
Inherited from: \Zend_View_Helper_HtmlElement::_normalizeId()\Zend_View_Helper_FormElement::_normalizeId()Name | Type | Description |
---|---|---|
$value | string |
Type | Description |
---|---|
string |


direct() : void
Strategy pattern: currently unutilized
Inherited from: \Zend_View_Helper_Abstract::direct()\Zend_View_Helper_HtmlElement::direct()\Zend_View_Helper_FormElement::direct()

formSelect(string | array $name, mixed $value = null, array | string $attribs = null, array $options = null, string $listsep = "
\n") : string
Generates 'select' list of options.
Name | Type | Description |
---|---|---|
$name | string | array | If a string, the element name. If an array, all other parameters are ignored, and the array elements are extracted in place of added parameters. |
$value | mixed | The option value to mark as 'selected'; if an array, will mark all values in the array as 'selected' (used for multiple-select elements). |
$attribs | array | string | Attributes added to the 'select' tag. the optional 'optionClasses' attribute is used to add a class to the options within the select (associative array linking the option value to the desired class) |
$options | array | An array of key-value pairs where the array key is the radio value, and the array value is the radio text. |
$listsep | string | When disabled, use this list separator string between list values. |
Type | Description |
---|---|
string | The select tag and options XHTML. |
- Access
- public


getClosingBracket() : string
Get the tag closing bracket
Inherited from: \Zend_View_Helper_HtmlElement::getClosingBracket()\Zend_View_Helper_FormElement::getClosingBracket()Type | Description |
---|---|
string |


getTranslator() : \Zend_Translate_Adapter | null
Type | Description |
---|---|
\Zend_Translate_Adapter | null |


setTranslator(\Zend_Translate | \Zend_Translate_Adapter | null $translator = null) : \Zend_View_Helper_FormElement
Name | Type | Description |
---|---|---|
$translator | \Zend_Translate | \Zend_Translate_Adapter | null |
Type | Description |
---|---|
\Zend_View_Helper_FormElement |


setView(\Zend_View_Interface $view) : \Zend_View_Helper_Abstract
Set the View object
Inherited from: \Zend_View_Helper_Abstract::setView()\Zend_View_Helper_HtmlElement::setView()\Zend_View_Helper_FormElement::setView()Name | Type | Description |
---|---|---|
$view | \Zend_View_Interface |
Type | Description |
---|---|
\Zend_View_Helper_Abstract |