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.
Zend_Form
DECORATOR = 'DECORATOR'
Details ELEMENT = 'ELEMENT'
Details METHOD_DELETE = 'delete'
Details METHOD_GET = 'get'
Details METHOD_POST = 'post'
Details METHOD_PUT = 'put'
Details ENCTYPE_URLENCODED = 'application/x-www-form-urlencoded'
Details ENCTYPE_MULTIPART = 'multipart/form-data'
Detailsarray $_attribs = 'array'Form metadata and attributes
Detailsarray $_decorators = 'array'Decorators for rendering
Detailsstring $_defaultDisplayGroupClass = 'Zend_Form_DisplayGroup'Default display group class
Detailsstring $_description = ''Form description
Detailsbool $_disableLoadDefaultDecorators = 'false'Should we disable loading the default decorators?
Detailsarray $_displayGroupPrefixPaths = 'array'Display group prefix paths
Detailsarray $_displayGroups = 'array'Groups of elements grouped for display purposes
Detailsnull|array $_elementDecorators = ''Global decorators to apply to all elements
Detailsarray $_elementPrefixPaths = 'array'Prefix paths to use when creating elements
Detailsarray $_elements = 'array'Form elements
Detailsstring $_elementsBelongTo = ''Array to which elements belong (if any)
Detailsarray $_errorMessages = 'array'Custom form-level error messages
Detailsbool $_errorsExist = 'false'Are there errors in the form?
Detailsbool $_errorsForced = 'false'Has the form been manually flagged as an error?
Detailsint|null $_formOrder = ''Form order
Detailsbool $_isArray = 'false'Whether or not form elements are members of an array
Detailsbool $_isRendered = 'false'
Detailsstring $_legend = ''Form legend
Detailsarray $_loaders = 'array'Plugin loaders
Detailsarray $_methods = 'array'Allowed form methods
Detailsarray $_order = 'array'Order in which to display and iterate elements
Detailsbool $_orderUpdated = 'false'Whether internal order has been updated or not
Detailsarray $_subFormPrefixPaths = 'array'Sub form prefix paths
Detailsarray $_subForms = 'array'Sub forms
DetailsZend_Translate $_translator = ''
DetailsZend_Translate $_translatorDefault = ''Global default translation adapter
Detailsbool $_translatorDisabled = 'false'is the translator disabled?
DetailsZend_View_Interface $_view = ''
Details__call(
string $method, array $args
)
:
stringOverloading: allow rendering specific decorators
Call renderDecoratorName() to render a specific decorator.
Details__clone(
)
:
voidClone form object and all children
Details__construct(
mixed $options
=
null
)
:
voidConstructor
Registers form view helper as decorator
Details__get(
string $name
)
:
Zend_Form_Element|Zend_Form|nullOverloading: access to elements, form groups, and display groups
Details__isset(
string $name
)
:
booleanOverloading: access to elements, form groups, and display groups
Details__set(
string $name, Zend_Form_Element|Zend_Form $value
)
:
voidOverloading: access to elements, form groups, and display groups
Details__toString(
)
:
stringSerialize as string
Proxies to {@link render()}.
Details__unset(
string $name
)
:
voidOverloading: access to elements, form groups, and display groups
Details_addDisplayGroupObject(
Zend_Form_DisplayGroup $group, string|null $name
=
null
)
:
Zend_FormAdd a display group object (used with cloning)
Details_array_replace_recursive(
array $into
)
:
voidThis is a helper function until php 5.3 is widespreaded
Details_attachToArray(
mixed $value, string $arrayPath
)
:
arrayConverts given arrayPath to an array and attaches given value at the end of it.
Details_dissolveArrayUnsetKey(
array $array, string|null $arrayPath, string $key
)
:
arrayGiven an array, an optional arrayPath and a key this method dissolves the arrayPath and unsets the key within the array if it exists.
Details_dissolveArrayValue(
array $value, string $arrayPath
)
:
stringExtract 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').
Details_getArrayName(
string $value
)
:
stringDetermine array key name from given value
Given a value such as foo[bar][baz], returns the last element (in this case, 'baz').
Details_getDecorator(
string $name, null|array $options
)
:
Zend_Form_Decorator_InterfaceInstantiate a decorator based on class name or class name fragment
Details_getErrorMessages(
)
:
arrayRetrieve optionally translated custom error messages
Details_getIsRendered(
)
:
Get the value of $_isRendered member
Details_loadDecorator(
array $decorator, mixed $name
)
:
Zend_Form_Decorator_InterfaceLazy-load a decorator
Details_setElementsBelongTo(
string $name
=
null
)
:
voidSet array to which elements belong
Details_setIsRendered(
)
:
When calling renderFormElements or render this method is used to set $_isRendered member to prevent repeatedly merging belongsTo setting
Details_sort(
)
:
voidSort items according to their order
DetailsaddAttribs(
array $attribs
)
:
Zend_FormAdd multiple form attributes at once
DetailsaddDecorator(
string|Zend_Form_Decorator_Interface $decorator, array|Zend_Config $options
=
null
)
:
Zend_FormAdd a decorator for rendering the element
DetailsaddDecorators(
array $decorators
)
:
Zend_FormAdd many decorators at once
DetailsaddDisplayGroup(
array $elements, string $name, array|Zend_Config $options
=
null
)
:
Zend_FormAdd a display group
Groups named elements for display purposes.
If a referenced element does not yet exist in the form, it is omitted.
DetailsaddDisplayGroupPrefixPath(
string $prefix, string $path
)
:
Zend_FormAdd prefix path for all display groups
DetailsaddDisplayGroupPrefixPaths(
array $spec
)
:
Zend_FormAdd multiple display group prefix paths at once
DetailsaddDisplayGroups(
array $groups
)
:
Zend_FormAdd multiple display groups at once
DetailsaddElement(
string|Zend_Form_Element $element, string $name
=
null, array|Zend_Config $options
=
null
)
:
Zend_FormAdd 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.
DetailsaddElementPrefixPath(
string $prefix, string $path, string $type
=
null
)
:
Zend_FormAdd prefix path for all elements
DetailsaddElementPrefixPaths(
array $spec
)
:
Zend_FormAdd prefix paths for all elements
DetailsaddElements(
array $elements
)
:
Zend_FormAdd multiple elements at once
DetailsaddError(
string $message
)
:
Zend_FormAdd an error message and mark element as failed validation
DetailsaddErrorMessage(
string $message
)
:
Zend_FormAdd a custom error message to return in the event of failed validation
DetailsaddErrorMessages(
array $messages
)
:
Zend_FormAdd multiple custom error messages to return in the event of failed validation
DetailsaddErrors(
array $messages
)
:
Zend_FormAdd multiple error messages and flag element as failed validation
DetailsaddPrefixPath(
string $prefix, string $path, string $type
=
null
)
:
Zend_FormAdd 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/'
DetailsaddPrefixPaths(
array $spec
)
:
Zend_FormAdd many prefix paths at once
DetailsaddSubForm(
Zend_Form $form, string $name, int $order
=
null
)
:
Zend_FormAdd a form group/subform
DetailsaddSubForms(
array $subForms
)
:
Zend_FormAdd multiple form subForms/subforms at once
DetailsclearAttribs(
)
:
Zend_FormClear all form attributes
DetailsclearDecorators(
)
:
Zend_FormClear all decorators
DetailsclearDisplayGroups(
)
:
Zend_FormRemove all display groups
DetailsclearElements(
)
:
Zend_FormRemove all form elements
DetailsclearErrorMessages(
)
:
Zend_FormClear custom error messages stack
DetailsclearSubForms(
)
:
Zend_FormRemove all form subForms/subforms
Detailscount(
)
:
intCount of elements/subforms that are iterable
DetailscreateElement(
string $type, string $name, array|Zend_Config $options
=
null
)
:
Zend_Form_ElementCreate 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.).
Detailscurrent(
)
:
Zend_Form_Element|Zend_Form_DisplayGroup|Zend_FormCurrent element/subform/display group
DetailsfilterName(
string $value, bool $allowBrackets
=
false
)
:
stringFilter a name to only allow valid variable characters
DetailsgetAction(
)
:
stringGet form action
Sets default to '' if not set.
DetailsgetAttrib(
string $key
)
:
mixedRetrieve a single form attribute
DetailsgetAttribs(
)
:
arrayRetrieve all form attributes/metadata
DetailsgetCustomMessages(
)
:
arrayRetrieve translated custom error messages Proxies to {@link _getErrorMessages()}.
DetailsgetDecorator(
string $name
)
:
false|Zend_Form_Decorator_AbstractRetrieve a registered decorator
DetailsgetDecorators(
)
:
arrayRetrieve all decorators
DetailsgetDefaultDisplayGroupClass(
)
:
stringRetrieve default display group class
DetailsgetDefaultTranslator(
)
:
null|Zend_TranslateGet global default translator object
DetailsgetDescription(
)
:
stringRetrieve form description
DetailsgetDisplayGroup(
string $name
)
:
Zend_Form_DisplayGroup|nullReturn a display group
DetailsgetDisplayGroups(
)
:
arrayReturn all display groups
DetailsgetElement(
string $name
)
:
Zend_Form_Element|nullRetrieve a single element
DetailsgetElements(
)
:
arrayRetrieve all elements
DetailsgetElementsAndSubFormsOrdered(
)
:
arrayReturns 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.
DetailsgetElementsBelongTo(
)
:
string|nullGet name of array elements belong to
DetailsgetEnctype(
)
:
stringGet encoding type
DetailsgetErrorMessages(
)
:
arrayRetrieve custom error messages
DetailsgetErrors(
string $name
=
null, $suppressArrayNotation
=
false
)
:
arrayGet error codes for all elements failing validation
DetailsgetFullyQualifiedName(
)
:
stringGet fully qualified name
Places name as subitem of array and/or appends brackets.
DetailsgetId(
)
:
stringGet element id
DetailsgetLegend(
)
:
stringGet form legend
DetailsgetMessages(
string $name
=
null, bool $suppressArrayNotation
=
false
)
:
arrayRetrieve error messages from elements failing validations
DetailsgetMethod(
)
:
stringRetrieve form method
DetailsgetName(
)
:
null|stringGet name attribute
DetailsgetOrder(
)
:
int|nullGet form order
DetailsgetPluginLoader(
string $type
=
null
)
:
Zend_Loader_PluginLoader_InterfaceRetrieve 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.
DetailsgetSubForm(
string $name
)
:
Zend_Form|nullRetrieve a form subForm/subform
DetailsgetSubForms(
)
:
arrayRetrieve all form subForms/subforms
DetailsgetTranslator(
)
:
Zend_Translate|nullRetrieve translator object
DetailsgetUnfilteredValue(
string $name
)
:
mixedGet unfiltered element value
DetailsgetUnfilteredValues(
)
:
arrayRetrieve all unfiltered element values
DetailsgetValidValues(
array $data, bool $suppressArrayNotation
=
false
)
:
arrayReturns 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.
DetailsgetValue(
string $name
)
:
mixedRetrieve value for single element
DetailsgetValues(
bool $suppressArrayNotation
=
false
)
:
arrayRetrieve all form element values
DetailsgetView(
)
:
Zend_View_Interface|nullRetrieve view object
If none registered, attempts to pull from ViewRenderer.
DetailshasDefaultTranslator(
)
:
booleanIs there a default translation object set?
DetailshasTranslator(
)
:
boolDoes this form have its own specific translator?
Detailsinit(
)
:
voidInitialize form (used by extending classes)
DetailsisArray(
)
:
boolGet flag indicating if elements belong to an array
DetailsisErrors(
)
:
boolAre there errors in the form?
DetailsisValid(
array $data
)
:
booleanValidate the form
DetailsisValidPartial(
array $data
)
:
booleanValidate a partial form
Does not check for required flags.
Detailskey(
)
:
stringCurrent element/subform/display group name
DetailsloadDefaultDecorators(
)
:
voidLoad the default decorators
DetailsloadDefaultDecoratorsIsDisabled(
)
:
boolShould we load the default decorators?
DetailsmarkAsError(
)
:
Zend_FormMark the element as being in a failed validation state
Detailsnext(
)
:
voidMove pointer to next element/subform/display group
DetailspersistData(
)
:
Detailspopulate(
array $values
)
:
Zend_FormPopulate form
Proxies to {@link setDefaults()}
DetailsprocessAjax(
array $data
)
:
stringProcess 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()}).
DetailsremoveAttrib(
string $key
)
:
boolRemove attribute
DetailsremoveDecorator(
string $name
)
:
boolRemove a single decorator
DetailsremoveDisplayGroup(
string $name
)
:
booleanRemove a display group by name
DetailsremoveElement(
string $name
)
:
booleanRemove element
DetailsremoveSubForm(
string $name
)
:
booleanRemove form subForm/subform
Detailsrender(
Zend_View_Interface $view
=
null
)
:
stringRender form
Detailsrewind(
)
:
voidMove pointer to beginning of element/subform/display group loop
DetailssetAction(
string $action
)
:
Zend_FormSet form action
DetailssetAttrib(
string $key, mixed $value
)
:
Zend_FormSet form attribute
DetailssetAttribs(
array $attribs
)
:
Zend_FormSet multiple form attributes at once
Overwrites any previously set attributes.
DetailssetConfig(
Zend_Config $config
)
:
Zend_FormSet form state from config object
DetailssetDecorators(
array $decorators
)
:
Zend_FormOverwrite all decorators
DetailssetDefault(
string $name, mixed $value
)
:
Zend_FormSet default value for an element
DetailssetDefaultDisplayGroupClass(
string $class
)
:
Zend_FormSet default display group class
DetailssetDefaultTranslator(
Zend_Translate|Zend_Translate_Adapter|null $translator
=
null
)
:
voidSet global default translator object
DetailssetDefaults(
array $defaults
)
:
Zend_FormSet default values for elements
Sets values for all elements specified in the array of $defaults.
DetailssetDescription(
string $value
)
:
Zend_FormSet form description
DetailssetDisableLoadDefaultDecorators(
bool $flag
)
:
Zend_FormSet flag to disable loading default decorators
DetailssetDisableTranslator(
bool $flag
)
:
Zend_FormIndicate whether or not translation should be disabled
DetailssetDisplayGroupDecorators(
array $decorators
)
:
Zend_FormSet all display group decorators as specified
DetailssetDisplayGroups(
array $groups
)
:
Zend_FormAdd multiple display groups (overwrites)
DetailssetElementDecorators(
array $decorators, array|null $elements
=
null, bool $include
=
true
)
:
Zend_FormSet all element decorators as specified
DetailssetElementFilters(
array $filters
)
:
Zend_FormSet all elements' filters
DetailssetElements(
array $elements
)
:
Zend_FormSet form elements (overwrites existing elements)
DetailssetElementsBelongTo(
string $array
)
:
Zend_FormSet name of array elements belong to
DetailssetEnctype(
string $value
)
:
Zend_FormSet encoding type
DetailssetErrorMessages(
array $messages
)
:
Zend_FormSame as addErrorMessages(), but clears custom error message stack first
DetailssetErrors(
array $messages
)
:
Zend_FormOverwrite any previously set error messages and flag as failed validation
DetailssetIsArray(
bool $flag
)
:
Zend_FormSet flag indicating elements belong to array
DetailssetLegend(
string $value
)
:
Zend_FormSet form legend
DetailssetMethod(
string $method
)
:
Zend_FormSet form method
Only values in {@link $_methods()} allowed
DetailssetName(
string $name
)
:
Zend_FormSet form name
DetailssetOptions(
array $options
)
:
Zend_FormSet form state from options array
DetailssetOrder(
int $index
)
:
Zend_FormSet form order
DetailssetPluginLoader(
Zend_Loader_PluginLoader_Interface $loader, string $type
=
null
)
:
Zend_FormSet plugin loaders for use with decorators and elements
DetailssetSubFormDecorators(
array $decorators
)
:
Zend_FormSet all subform decorators as specified
DetailssetSubForms(
array $subForms
)
:
Zend_FormSet multiple form subForms/subforms (overwrites)
DetailssetTranslator(
Zend_Translate|Zend_Translate_Adapter|null $translator
=
null
)
:
Zend_FormSet translator object
DetailssetView(
Zend_View_Interface $view
=
null
)
:
Zend_FormSet view object
DetailstranslatorIsDisabled(
)
:
boolIs translation disabled?
Detailsvalid(
)
:
boolDetermine if current element/subform/display group is valid
Details