API Documentation

Zend/Form.php

Show: inherited
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_Form  

\Zend_Form

Package: Zend\Form

Zend_Form

Implements
\Zend_Validate_Interface
Children
\Zend_Dojo_Form
\Zend_Form_SubForm
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Used_by
\Zend_Dojo_Form  
Version
$Id: Form.php 24594 2012-01-05 21:27:01Z matthew $  

Constants

Constant  DECORATOR = 'DECORATOR'
Constant  ELEMENT = 'ELEMENT'
Constant  METHOD_DELETE = 'delete'
Constant  METHOD_GET = 'get'
Constant  METHOD_POST = 'post'
Constant  METHOD_PUT = 'put'
Constant  ENCTYPE_URLENCODED = 'application/x-www-form-urlencoded'
Constant  ENCTYPE_MULTIPART = 'multipart/form-data'

Properties

Propertyprotectedarray  $_attribs= 'array()'

Form metadata and attributes

Default valuearray()Details
Type
array
Propertyprotectedarray  $_decorators= 'array()'

Decorators for rendering

Default valuearray()Details
Type
array
Propertyprotectedstring  $_defaultDisplayGroupClass= ''Zend_Form_DisplayGroup''

Default display group class

Default value'Zend_Form_DisplayGroup'Details
Type
string
Propertyprotectedstring  $_description= ''

Form description

Details
Type
string
Propertyprotectedbool  $_disableLoadDefaultDecorators= 'false'

Should we disable loading the default decorators?

Default valuefalseDetails
Type
bool
Propertyprotectedarray  $_displayGroupPrefixPaths= 'array()'

Display group prefix paths

Default valuearray()Details
Type
array
Propertyprotectedarray  $_displayGroups= 'array()'

Groups of elements grouped for display purposes

Default valuearray()Details
Type
array
Propertyprotectednull|array  $_elementDecorators= ''

Global decorators to apply to all elements

Details
Type
nullarray
Propertyprotectedarray  $_elementPrefixPaths= 'array()'

Prefix paths to use when creating elements

Default valuearray()Details
Type
array
Propertyprotectedarray  $_elements= 'array()'

Form elements

Default valuearray()Details
Type
array
Propertyprotectedstring  $_elementsBelongTo= ''

Array to which elements belong (if any)

Details
Type
string
Propertyprotectedarray  $_errorMessages= 'array()'

Custom form-level error messages

Default valuearray()Details
Type
array
Propertyprotectedbool  $_errorsExist= 'false'

Are there errors in the form?

Default valuefalseDetails
Type
bool
Propertyprotectedbool  $_errorsForced= 'false'

Has the form been manually flagged as an error?

Default valuefalseDetails
Type
bool
Propertyprotectedint|null  $_formOrder= ''

Form order

Details
Type
intnull
Propertyprotectedbool  $_isArray= 'false'

Whether or not form elements are members of an array

Default valuefalseDetails
Type
bool
Propertyprotectedbool  $_isRendered= 'false'

Default valuefalseDetails
Type
bool
Propertyprotectedstring  $_legend= ''

Form legend

Details
Type
string
Propertyprotectedarray  $_loaders= 'array()'

Plugin loaders

Default valuearray()Details
Type
array
Propertyprotectedarray  $_methods= 'array('delete''

Allowed form methods

Default valuearray('delete'Details
Type
array
Propertyprotectedarray  $_order= 'array()'

Order in which to display and iterate elements

Default valuearray()Details
Type
array
Propertyprotectedbool  $_orderUpdated= 'false'

Whether internal order has been updated or not

Default valuefalseDetails
Type
bool
Propertyprotectedarray  $_subFormPrefixPaths= 'array()'

Sub form prefix paths

Default valuearray()Details
Type
array
Propertyprotectedarray  $_subForms= 'array()'

Sub forms

Default valuearray()Details
Type
array
Propertyprotected\Zend_Translate  $_translator= ''

Details
Type
\Zend_Translate
Propertyprotected\Zend_Translate  $_translatorDefault= ''
static

Global default translation adapter

Details
Type
\Zend_Translate
Propertyprotectedbool  $_translatorDisabled= 'false'

is the translator disabled?

Default valuefalseDetails
Type
bool
Propertyprotected\Zend_View_Interface  $_view= ''

Details
Type
\Zend_View_Interface

Methods

methodpublic__call( string $method, array $args ) : string

Overloading: allow rendering specific decorators

Call renderDecoratorName() to render a specific decorator.

Parameters
Name Type Description
$method string
$args array
Returns
Type Description
string
Throws
Exception Description
\Zend_Form_Exception for invalid decorator or invalid method call
methodpublic__clone( ) : void

Clone form object and all children

methodpublic__construct( mixed $options = null ) : void

Constructor

Registers form view helper as decorator

Parameters
Name Type Description
$options mixed
methodpublic__get( string $name ) : \Zend_Form_Element|\Zend_Form|null

Overloading: access to elements, form groups, and display groups

Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Form_Element|\Zend_Form|null
methodpublic__isset( string $name ) : boolean

Overloading: access to elements, form groups, and display groups

Parameters
Name Type Description
$name string
Returns
Type Description
boolean
methodpublic__set( string $name, \Zend_Form_Element|\Zend_Form $value ) : void

Overloading: access to elements, form groups, and display groups

Parameters
Name Type Description
$name string
$value \Zend_Form_Element|\Zend_Form
Throws
Exception Description
\Zend_Form_Exception for invalid $value
methodpublic__toString( ) : string

Serialize as string

Proxies to {@link render()}.

Returns
Type Description
string
methodpublic__unset( string $name ) : void

Overloading: access to elements, form groups, and display groups

Parameters
Name Type Description
$name string
methodprotected_addDisplayGroupObject( \Zend_Form_DisplayGroup $group, string|null $name = null ) : \Zend_Form

Add a display group object (used with cloning)

Parameters
Name Type Description
$group \Zend_Form_DisplayGroup
$name string|null
Returns
Type Description
\Zend_Form
methodprotected_array_replace_recursive( array $into ) : void

This is a helper function until php 5.3 is widespreaded

Parameters
Name Type Description
$into array
Details
Access
protected  
methodprotected_attachToArray( mixed $value, string $arrayPath ) : array

Converts given arrayPath to an array and attaches given value at the end of it.

Parameters
Name Type Description
$value mixed

The value to attach

$arrayPath string

Given array path to convert and attach to.

Returns
Type Description
array
methodprotected_dissolveArrayUnsetKey( array $array, string|null $arrayPath, string $key ) : array

Given an array, an optional arrayPath and a key this method dissolves the arrayPath and unsets the key within the array if it exists.

Parameters
Name Type Description
$array array
$arrayPath string|null
$key string
Returns
Type Description
array
methodprotected_dissolveArrayValue( array $value, string $arrayPath ) : string

Extract the value by walking the array using given array path.

Given an array path such as foo[bar][baz], returns the value of the last element (in this case, 'baz').

Parameters
Name Type Description
$value array

Array to walk

$arrayPath string

Array notation path of the part to extract

Returns
Type Description
string
methodprotected_getArrayName( string $value ) : string

Determine array key name from given value

Given a value such as foo[bar][baz], returns the last element (in this case, 'baz').

Parameters
Name Type Description
$value string
Returns
Type Description
string
methodprotected_getDecorator( string $name, null|array $options ) : \Zend_Form_Decorator_Interface

Instantiate a decorator based on class name or class name fragment

Parameters
Name Type Description
$name string
$options null|array
Returns
Type Description
\Zend_Form_Decorator_Interface
methodprotected_getErrorMessages( ) : array

Retrieve optionally translated custom error messages

Returns
Type Description
array
methodprotected_getIsRendered( ) : void

Get the value of $_isRendered member

methodprotected_loadDecorator( array $decorator, mixed $name ) : \Zend_Form_Decorator_Interface

Lazy-load a decorator

Parameters
Name Type Description
$decorator array

Decorator type and options

$name mixed

Decorator name or alias

Returns
Type Description
\Zend_Form_Decorator_Interface
methodprotected_setElementsBelongTo( string $name = null ) : void

Set array to which elements belong

Parameters
Name Type Description
$name string

Element name

methodprotected_setIsRendered( ) : void

When calling renderFormElements or render this method is used to set $_isRendered member to prevent repeatedly merging belongsTo setting

methodprotected_sort( ) : void

Sort items according to their order

methodpublicaddAttribs( array $attribs ) : \Zend_Form

Add multiple form attributes at once

Parameters
Name Type Description
$attribs array
Returns
Type Description
\Zend_Form
methodpublicaddDecorator( string|\Zend_Form_Decorator_Interface $decorator, array|\Zend_Config $options = null ) : \Zend_Form

Add a decorator for rendering the element

Parameters
Name Type Description
$decorator string|\Zend_Form_Decorator_Interface
$options array|\Zend_Config

Options with which to initialize decorator

Returns
Type Description
\Zend_Form
methodpublicaddDecorators( array $decorators ) : \Zend_Form

Add many decorators at once

Parameters
Name Type Description
$decorators array
Returns
Type Description
\Zend_Form
methodpublicaddDisplayGroup( array $elements, string $name, array|\Zend_Config $options = null ) : \Zend_Form

Add a display group

Groups named elements for display purposes.

If a referenced element does not yet exist in the form, it is omitted.

Parameters
Name Type Description
$elements array
$name string
$options array|\Zend_Config
Returns
Type Description
\Zend_Form
Throws
Exception Description
\Zend_Form_Exception if no valid elements provided
methodpublicaddDisplayGroupPrefixPath( string $prefix, string $path ) : \Zend_Form

Add prefix path for all display groups

Parameters
Name Type Description
$prefix string
$path string
Returns
Type Description
\Zend_Form
methodpublicaddDisplayGroupPrefixPaths( array $spec ) : \Zend_Form

Add multiple display group prefix paths at once

Parameters
Name Type Description
$spec array
Returns
Type Description
\Zend_Form
methodpublicaddDisplayGroups( array $groups ) : \Zend_Form

Add multiple display groups at once

Parameters
Name Type Description
$groups array
Returns
Type Description
\Zend_Form
methodpublicaddElement( string|\Zend_Form_Element $element, string $name = null, array|\Zend_Config $options = null ) : \Zend_Form

Add a new element

$element may be either a string element type, or an object of type Zend_Form_Element. If a string element type is provided, $name must be provided, and $options may be optionally provided for configuring the element.

If a Zend_Form_Element is provided, $name may be optionally provided, and any provided $options will be ignored.

Parameters
Name Type Description
$element string|\Zend_Form_Element
$name string
$options array|\Zend_Config
Returns
Type Description
\Zend_Form
Throws
Exception Description
\Zend_Form_Exception on invalid element
methodpublicaddElementPrefixPath( string $prefix, string $path, string $type = null ) : \Zend_Form

Add prefix path for all elements

Parameters
Name Type Description
$prefix string
$path string
$type string
Returns
Type Description
\Zend_Form
methodpublicaddElementPrefixPaths( array $spec ) : \Zend_Form

Add prefix paths for all elements

Parameters
Name Type Description
$spec array
Returns
Type Description
\Zend_Form
methodpublicaddElements( array $elements ) : \Zend_Form

Add multiple elements at once

Parameters
Name Type Description
$elements array
Returns
Type Description
\Zend_Form
methodpublicaddError( string $message ) : \Zend_Form

Add an error message and mark element as failed validation

Parameters
Name Type Description
$message string
Returns
Type Description
\Zend_Form
methodpublicaddErrorMessage( string $message ) : \Zend_Form

Add a custom error message to return in the event of failed validation

Parameters
Name Type Description
$message string
Returns
Type Description
\Zend_Form
methodpublicaddErrorMessages( array $messages ) : \Zend_Form

Add multiple custom error messages to return in the event of failed validation

Parameters
Name Type Description
$messages array
Returns
Type Description
\Zend_Form
methodpublicaddErrors( array $messages ) : \Zend_Form

Add multiple error messages and flag element as failed validation

Parameters
Name Type Description
$messages array
Returns
Type Description
\Zend_Form
methodpublicaddPrefixPath( string $prefix, string $path, string $type = null ) : \Zend_Form

Add prefix path for plugin loader

If no $type specified, assumes it is a base path for both filters and validators, and sets each according to the following rules: - decorators: $prefix = $prefix . '_Decorator' - elements: $prefix = $prefix . '_Element'

Otherwise, the path prefix is set on the appropriate plugin loader.

If $type is 'decorator', sets the path in the decorator plugin loader for all elements. Additionally, if no $type is provided, the prefix and path is added to both decorator and element plugin loader with following settings: $prefix . '_Decorator', $path . '/Decorator/' $prefix . '_Element', $path . '/Element/'

Parameters
Name Type Description
$prefix string
$path string
$type string
Returns
Type Description
\Zend_Form
Throws
Exception Description
\Zend_Form_Exception for invalid type
methodpublicaddPrefixPaths( array $spec ) : \Zend_Form

Add many prefix paths at once

Parameters
Name Type Description
$spec array
Returns
Type Description
\Zend_Form
methodpublicaddSubForm( \Zend_Form $form, string $name, int $order = null ) : \Zend_Form

Add a form group/subform

Parameters
Name Type Description
$form \Zend_Form
$name string
$order int
Returns
Type Description
\Zend_Form
methodpublicaddSubForms( array $subForms ) : \Zend_Form

Add multiple form subForms/subforms at once

Parameters
Name Type Description
$subForms array
Returns
Type Description
\Zend_Form
methodpublicclearAttribs( ) : \Zend_Form

Clear all form attributes

Returns
Type Description
\Zend_Form
methodpublicclearDecorators( ) : \Zend_Form

Clear all decorators

Returns
Type Description
\Zend_Form
methodpublicclearDisplayGroups( ) : \Zend_Form

Remove all display groups

Returns
Type Description
\Zend_Form
methodpublicclearElements( ) : \Zend_Form

Remove all form elements

Returns
Type Description
\Zend_Form
methodpublicclearErrorMessages( ) : \Zend_Form

Clear custom error messages stack

Returns
Type Description
\Zend_Form
methodpublicclearSubForms( ) : \Zend_Form

Remove all form subForms/subforms

Returns
Type Description
\Zend_Form
methodpubliccount( ) : int

Count of elements/subforms that are iterable

Returns
Type Description
int
methodpubliccreateElement( string $type, string $name, array|\Zend_Config $options = null ) : \Zend_Form_Element

Create an element

Acts as a factory for creating elements. Elements created with this method will not be attached to the form, but will contain element settings as specified in the form object (including plugin loader prefix paths, default decorators, etc.).

Parameters
Name Type Description
$type string
$name string
$options array|\Zend_Config
Returns
Type Description
\Zend_Form_Element
methodpubliccurrent( ) : \Zend_Form_Element|\Zend_Form_DisplayGroup|\Zend_Form

Current element/subform/display group

methodpublicfilterName( string $value, bool $allowBrackets = false ) : string

Filter a name to only allow valid variable characters

Parameters
Name Type Description
$value string
$allowBrackets bool
Returns
Type Description
string
methodpublicgetAction( ) : string

Get form action

Sets default to '' if not set.

Returns
Type Description
string
methodpublicgetAttrib( string $key ) : mixed

Retrieve a single form attribute

Parameters
Name Type Description
$key string
Returns
Type Description
mixed
methodpublicgetAttribs( ) : array

Retrieve all form attributes/metadata

Returns
Type Description
array
methodpublicgetCustomMessages( ) : array

Retrieve translated custom error messages Proxies to {@link _getErrorMessages()}.

Returns
Type Description
array
methodpublicgetDecorator( string $name ) : false|\Zend_Form_Decorator_Abstract

Retrieve a registered decorator

Parameters
Name Type Description
$name string
Returns
Type Description
false|\Zend_Form_Decorator_Abstract
methodpublicgetDecorators( ) : array

Retrieve all decorators

Returns
Type Description
array
methodpublicgetDefaultDisplayGroupClass( ) : string

Retrieve default display group class

Returns
Type Description
string
methodpublicgetDefaultTranslator( ) : null|\Zend_Translate
static

Get global default translator object

Returns
Type Description
null|\Zend_Translate
methodpublicgetDescription( ) : string

Retrieve form description

Returns
Type Description
string
methodpublicgetDisplayGroup( string $name ) : \Zend_Form_DisplayGroup|null

Return a display group

Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Form_DisplayGroup|null
methodpublicgetDisplayGroups( ) : array

Return all display groups

Returns
Type Description
array
methodpublicgetElement( string $name ) : \Zend_Form_Element|null

Retrieve a single element

Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Form_Element|null
methodpublicgetElements( ) : array

Retrieve all elements

Returns
Type Description
array
methodpublicgetElementsAndSubFormsOrdered( ) : array

Returns a one dimensional numerical indexed array with the Elements, SubForms and Elements from DisplayGroups as Values.

Subitems are inserted based on their order Setting if set, otherwise they are appended, the resulting numerical index may differ from the order value.

Returns
Type Description
array
Details
Access
protected  
methodpublicgetElementsBelongTo( ) : string|null

Get name of array elements belong to

Returns
Type Description
string|null
methodpublicgetEnctype( ) : string

Get encoding type

Returns
Type Description
string
methodpublicgetErrorMessages( ) : array

Retrieve custom error messages

Returns
Type Description
array
methodpublicgetErrors( string $name = null,  $suppressArrayNotation = false ) : array

Get error codes for all elements failing validation

Parameters
Name Type Description
$name string
$suppressArrayNotation
Returns
Type Description
array
methodpublicgetFullyQualifiedName( ) : string

Get fully qualified name

Places name as subitem of array and/or appends brackets.

Returns
Type Description
string
methodpublicgetId( ) : string

Get element id

Returns
Type Description
string
methodpublicgetLegend( ) : string

Get form legend

Returns
Type Description
string
methodpublicgetMessages( string $name = null, bool $suppressArrayNotation = false ) : array

Retrieve error messages from elements failing validations

Parameters
Name Type Description
$name string
$suppressArrayNotation bool
Returns
Type Description
array
methodpublicgetMethod( ) : string

Retrieve form method

Returns
Type Description
string
methodpublicgetName( ) : null|string

Get name attribute

Returns
Type Description
null|string
methodpublicgetOrder( ) : int|null

Get form order

Returns
Type Description
int|null
methodpublicgetPluginLoader( string $type = null ) : \Zend_Loader_PluginLoader_Interface

Retrieve plugin loader for given type

$type may be one of: - decorator - element

If a plugin loader does not exist for the given type, defaults are created.

Parameters
Name Type Description
$type string
Returns
Type Description
\Zend_Loader_PluginLoader_Interface
methodpublicgetSubForm( string $name ) : \Zend_Form|null

Retrieve a form subForm/subform

Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Form|null
methodpublicgetSubForms( ) : array

Retrieve all form subForms/subforms

Returns
Type Description
array
methodpublicgetTranslator( ) : \Zend_Translate|null

Retrieve translator object

Returns
Type Description
\Zend_Translate|null
methodpublicgetUnfilteredValue( string $name ) : mixed

Get unfiltered element value

Parameters
Name Type Description
$name string
Returns
Type Description
mixed
methodpublicgetUnfilteredValues( ) : array

Retrieve all unfiltered element values

Returns
Type Description
array
methodpublicgetValidValues( array $data, bool $suppressArrayNotation = false ) : array

Returns only the valid values from the given form input.

For models that can be saved in a partially valid state, for example when following the builder, prototype or state patterns it is particularly interessting to retrieve all the current valid values to persist them.

Parameters
Name Type Description
$data array
$suppressArrayNotation bool
Returns
Type Description
array
methodpublicgetValue( string $name ) : mixed

Retrieve value for single element

Parameters
Name Type Description
$name string
Returns
Type Description
mixed
methodpublicgetValues( bool $suppressArrayNotation = false ) : array

Retrieve all form element values

Parameters
Name Type Description
$suppressArrayNotation bool
Returns
Type Description
array
methodpublicgetView( ) : \Zend_View_Interface|null

Retrieve view object

If none registered, attempts to pull from ViewRenderer.

Returns
Type Description
\Zend_View_Interface|null
methodpublichasDefaultTranslator( ) : boolean
static

Is there a default translation object set?

Returns
Type Description
boolean
methodpublichasTranslator( ) : bool

Does this form have its own specific translator?

Returns
Type Description
bool
methodpublicinit( ) : void

Initialize form (used by extending classes)

methodpublicisArray( ) : bool

Get flag indicating if elements belong to an array

Returns
Type Description
bool
methodpublicisErrors( ) : bool

Are there errors in the form?

Returns
Type Description
bool
methodpublicisValid( array $data ) : boolean

Validate the form

Parameters
Name Type Description
$data array
Returns
Type Description
boolean
methodpublicisValidPartial( array $data ) : boolean

Validate a partial form

Does not check for required flags.

Parameters
Name Type Description
$data array
Returns
Type Description
boolean
methodpublickey( ) : string

Current element/subform/display group name

Returns
Type Description
string
methodpublicloadDefaultDecorators( ) : \Zend_Form

Load the default decorators

Returns
Type Description
\Zend_Form
methodpublicloadDefaultDecoratorsIsDisabled( ) : bool

Should we load the default decorators?

Returns
Type Description
bool
methodpublicmarkAsError( ) : \Zend_Form

Mark the element as being in a failed validation state

Returns
Type Description
\Zend_Form
methodpublicnext( ) : void

Move pointer to next element/subform/display group

methodpublicpersistData( ) : void

methodpublicpopulate( array $values ) : \Zend_Form

Populate form

Proxies to {@link setDefaults()}

Parameters
Name Type Description
$values array
Returns
Type Description
\Zend_Form
methodpublicprocessAjax( array $data ) : string

Process submitted AJAX data

Checks if provided $data is valid, via {@link isValidPartial()}. If so, it returns JSON-encoded boolean true. If not, it returns JSON-encoded error messages (as returned by {@link getMessages()}).

Parameters
Name Type Description
$data array
Returns
Type Description
string JSON-encoded boolean true or error messages
methodpublicremoveAttrib( string $key ) : bool

Remove attribute

Parameters
Name Type Description
$key string
Returns
Type Description
bool
methodpublicremoveDecorator( string $name ) : bool

Remove a single decorator

Parameters
Name Type Description
$name string
Returns
Type Description
bool
methodpublicremoveDisplayGroup( string $name ) : boolean

Remove a display group by name

Parameters
Name Type Description
$name string
Returns
Type Description
boolean
methodpublicremoveElement( string $name ) : boolean

Remove element

Parameters
Name Type Description
$name string
Returns
Type Description
boolean
methodpublicremoveFromIteration( string $name ) : void

Remove an element from iteration

Parameters
Name Type Description
$name string

Element/group/form name

methodpublicremoveSubForm( string $name ) : boolean

Remove form subForm/subform

Parameters
Name Type Description
$name string
Returns
Type Description
boolean
methodpublicrender( \Zend_View_Interface $view = null ) : string

Render form

Parameters
Name Type Description
$view \Zend_View_Interface
Returns
Type Description
string
methodpublicreset( ) : \Zend_Form

Reset values of form

Returns
Type Description
\Zend_Form
methodpublicrewind( ) : void

Move pointer to beginning of element/subform/display group loop

methodpublicsetAction( string $action ) : \Zend_Form

Set form action

Parameters
Name Type Description
$action string
Returns
Type Description
\Zend_Form
methodpublicsetAttrib( string $key, mixed $value ) : \Zend_Form

Set form attribute

Parameters
Name Type Description
$key string
$value mixed
Returns
Type Description
\Zend_Form
methodpublicsetAttribs( array $attribs ) : \Zend_Form

Set multiple form attributes at once

Overwrites any previously set attributes.

Parameters
Name Type Description
$attribs array
Returns
Type Description
\Zend_Form
methodpublicsetConfig( \Zend_Config $config ) : \Zend_Form

Set form state from config object

Parameters
Name Type Description
$config \Zend_Config
Returns
Type Description
\Zend_Form
methodpublicsetDecorators( array $decorators ) : \Zend_Form

Overwrite all decorators

Parameters
Name Type Description
$decorators array
Returns
Type Description
\Zend_Form
methodpublicsetDefault( string $name, mixed $value ) : \Zend_Form

Set default value for an element

Parameters
Name Type Description
$name string
$value mixed
Returns
Type Description
\Zend_Form
methodpublicsetDefaultDisplayGroupClass( string $class ) : \Zend_Form

Set default display group class

Parameters
Name Type Description
$class string
Returns
Type Description
\Zend_Form
methodpublicsetDefaultTranslator( \Zend_Translate|\Zend_Translate_Adapter|null $translator = null ) : void
static

Set global default translator object

Parameters
Name Type Description
$translator \Zend_Translate|\Zend_Translate_Adapter|null
methodpublicsetDefaults( array $defaults ) : \Zend_Form

Set default values for elements

Sets values for all elements specified in the array of $defaults.

Parameters
Name Type Description
$defaults array
Returns
Type Description
\Zend_Form
methodpublicsetDescription( string $value ) : \Zend_Form

Set form description

Parameters
Name Type Description
$value string
Returns
Type Description
\Zend_Form
methodpublicsetDisableLoadDefaultDecorators( bool $flag ) : \Zend_Form

Set flag to disable loading default decorators

Parameters
Name Type Description
$flag bool
Returns
Type Description
\Zend_Form
methodpublicsetDisableTranslator( bool $flag ) : \Zend_Form

Indicate whether or not translation should be disabled

Parameters
Name Type Description
$flag bool
Returns
Type Description
\Zend_Form
methodpublicsetDisplayGroupDecorators( array $decorators ) : \Zend_Form

Set all display group decorators as specified

Parameters
Name Type Description
$decorators array
Returns
Type Description
\Zend_Form
methodpublicsetDisplayGroups( array $groups ) : \Zend_Form

Add multiple display groups (overwrites)

Parameters
Name Type Description
$groups array
Returns
Type Description
\Zend_Form
methodpublicsetElementDecorators( array $decorators, array|null $elements = null, bool $include = true ) : \Zend_Form

Set all element decorators as specified

Parameters
Name Type Description
$decorators array
$elements array|null

Specific elements to decorate or exclude from decoration

$include bool

Whether $elements is an inclusion or exclusion list

Returns
Type Description
\Zend_Form
methodpublicsetElementFilters( array $filters ) : \Zend_Form

Set all elements' filters

Parameters
Name Type Description
$filters array
Returns
Type Description
\Zend_Form
methodpublicsetElements( array $elements ) : \Zend_Form

Set form elements (overwrites existing elements)

Parameters
Name Type Description
$elements array
Returns
Type Description
\Zend_Form
methodpublicsetElementsBelongTo( string $array ) : \Zend_Form

Set name of array elements belong to

Parameters
Name Type Description
$array string
Returns
Type Description
\Zend_Form
methodpublicsetEnctype( string $value ) : \Zend_Form

Set encoding type

Parameters
Name Type Description
$value string
Returns
Type Description
\Zend_Form
methodpublicsetErrorMessages( array $messages ) : \Zend_Form

Same as addErrorMessages(), but clears custom error message stack first

Parameters
Name Type Description
$messages array
Returns
Type Description
\Zend_Form
methodpublicsetErrors( array $messages ) : \Zend_Form

Overwrite any previously set error messages and flag as failed validation

Parameters
Name Type Description
$messages array
Returns
Type Description
\Zend_Form
methodpublicsetIsArray( bool $flag ) : \Zend_Form

Set flag indicating elements belong to array

Parameters
Name Type Description
$flag bool

Value of flag

Returns
Type Description
\Zend_Form
methodpublicsetLegend( string $value ) : \Zend_Form

Set form legend

Parameters
Name Type Description
$value string
Returns
Type Description
\Zend_Form
methodpublicsetMethod( string $method ) : \Zend_Form

Set form method

Only values in {@link $_methods()} allowed

Parameters
Name Type Description
$method string
Returns
Type Description
\Zend_Form
Throws
Exception Description
\Zend_Form_Exception
methodpublicsetName( string $name ) : \Zend_Form

Set form name

Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Form
methodpublicsetOptions( array $options ) : \Zend_Form

Set form state from options array

Parameters
Name Type Description
$options array
Returns
Type Description
\Zend_Form
methodpublicsetOrder( int $index ) : \Zend_Form

Set form order

Parameters
Name Type Description
$index int
Returns
Type Description
\Zend_Form
methodpublicsetPluginLoader( \Zend_Loader_PluginLoader_Interface $loader, string $type = null ) : \Zend_Form

Set plugin loaders for use with decorators and elements

Parameters
Name Type Description
$loader \Zend_Loader_PluginLoader_Interface
$type string

'decorator' or 'element'

Returns
Type Description
\Zend_Form
Throws
Exception Description
\Zend_Form_Exception on invalid type
methodpublicsetSubFormDecorators( array $decorators ) : \Zend_Form

Set all subform decorators as specified

Parameters
Name Type Description
$decorators array
Returns
Type Description
\Zend_Form
methodpublicsetSubForms( array $subForms ) : \Zend_Form

Set multiple form subForms/subforms (overwrites)

Parameters
Name Type Description
$subForms array
Returns
Type Description
\Zend_Form
methodpublicsetTranslator( \Zend_Translate|\Zend_Translate_Adapter|null $translator = null ) : \Zend_Form

Set translator object

Parameters
Name Type Description
$translator \Zend_Translate|\Zend_Translate_Adapter|null
Returns
Type Description
\Zend_Form
methodpublicsetView( \Zend_View_Interface $view = null ) : \Zend_Form

Set view object

Parameters
Name Type Description
$view \Zend_View_Interface
Returns
Type Description
\Zend_Form
methodpublictranslatorIsDisabled( ) : bool

Is translation disabled?

Returns
Type Description
bool
methodpublicvalid( ) : bool

Determine if current element/subform/display group is valid

Returns
Type Description
bool
Documentation was generated by DocBlox 0.15.1.