View/Helper/FormSelect.php

Show: PublicProtectedPrivateinherited
Table of Contents
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 license@zend.com 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

Package: Zend\View\Helper
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

Properties

>VPropertyprotectedstring $_closingBracket = null
Default valuenullDetails
Type
string
Inherited_from
\Zend_View_Helper_HtmlElement::$$_closingBracket  
Inherited_from
\Zend_View_Helper_FormElement::$$_closingBracket  
>VPropertyprotected\Zend_Translate_Adapter|null $_translator

Methods

methodprotected_build(string $value, string $label, array $selected, array | bool $disable, array $optionClasses = array()) : string

Builds the actual

Parameters
NameTypeDescription
$valuestring

Options Value

$labelstring

Options Label

$selectedarray

The option value(s) to mark as 'selected'

$disablearray | bool

Whether the select is disabled, or individual options are

$optionClassesarray

The classes to associate with each option value

Returns
TypeDescription
stringOption Tag XHTML
methodprotected_getInfo( $name,  $value = null,  $attribs = null,  $options = null,  $listsep = null) : array
inherited

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.

Parameters
NameTypeDescription
$name
$value
$attribs
$options
$listsep
Returns
TypeDescription
arrayAn element info array with keys for name, value, attribs, options, listsep, disable, and escape.
Details
Access
protected  
methodprotected_hidden(string $name, string $value = null, array $attribs = null) : string
inherited

Creates a hidden element.

Inherited from: \Zend_View_Helper_FormElement::_hidden()

We have this as a common method because other elements often need hidden elements for their operation.

Parameters
NameTypeDescription
$namestring

The element name.

$valuestring

The element value.

$attribsarray

Attributes for the element.

Returns
TypeDescription
stringA hidden element.
Details
Access
protected  
methodprotected_htmlAttribs(array $attribs) : string
inherited

Converts an associative array to a string of tag attributes.

Inherited from: \Zend_View_Helper_HtmlElement::_htmlAttribs()\Zend_View_Helper_FormElement::_htmlAttribs()
Parameters
NameTypeDescription
$attribsarray

From this array, each key-value pair is converted to an attribute name and value.

Returns
TypeDescription
stringThe XHTML for the attributes.
Details
Access
public  
methodprotected_isStrictDoctype() : boolean
Returns
TypeDescription
boolean
methodprotected_isXhtml() : boolean
Returns
TypeDescription
boolean
methodprotected_normalizeId(string $value) : string
Parameters
NameTypeDescription
$valuestring
Returns
TypeDescription
string
methodpublicdirect() : void
methodpublicformSelect(string | array $name, mixed $value = null, array | string $attribs = null, array $options = null, string $listsep = "
\n")
: string

Generates 'select' list of options.

Parameters
NameTypeDescription
$namestring | 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.

$valuemixed

The option value to mark as 'selected'; if an array, will mark all values in the array as 'selected' (used for multiple-select elements).

$attribsarray | 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)

$optionsarray

An array of key-value pairs where the array key is the radio value, and the array value is the radio text.

$listsepstring

When disabled, use this list separator string between list values.

Returns
TypeDescription
stringThe select tag and options XHTML.
Details
Access
public  
methodpublicgetClosingBracket() : string
Returns
TypeDescription
string
methodpublicgetTranslator() : \Zend_Translate_Adapter | null
inherited

Get translator

Inherited from: \Zend_View_Helper_FormElement::getTranslator()
Returns
TypeDescription
\Zend_Translate_Adapter | null
methodpublicsetTranslator(\Zend_Translate | \Zend_Translate_Adapter | null $translator = null) : \Zend_View_Helper_FormElement
inherited

Set translator

Inherited from: \Zend_View_Helper_FormElement::setTranslator()
Parameters
NameTypeDescription
$translator\Zend_Translate | \Zend_Translate_Adapter | null
Returns
TypeDescription
\Zend_View_Helper_FormElement
Documentation was generated by phpDocumentor 2.0.0a12.