Form/Element.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Form
\Zend_Form_Element
- Implements
- Children
- \Zend_Dojo_Form_Element_Dijit
- \Zend_Form_Element_Xhtml
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Version
- $Id$
Constants
Properties

bool $_autoInsertNotEmptyValidator = truetrueDetails- Type
- bool

bool $_concatJustValuesInErrorMessage = falsefalseDetails- Type
- bool

bool $_disableLoadDefaultDecorators = falsefalseDetails- Type
- bool

string $_errorMessageSeparator = '; ''; 'Details- Type
- string

bool $_ignore = falsefalseDetails- Type
- bool

bool $_isErrorForced = falsefalseDetails- Type
- bool

bool $_isPartialRendering = falsefalseDetails- Type
- bool

array $_loaders = array()array()Details- Type
- array

array $_validatorRules = array()array()Details- Type
- array
Methods

__call(string $method, array $args) : stringOverloading: allow rendering specific decorators
| Name | Type | Description |
|---|---|---|
| $method | string | |
| $args | array |
| Type | Description |
|---|---|
| string |
| Exception | Description |
|---|---|
| \Zend_Form_Exception | for invalid decorator or invalid method call |

__construct(string | array | \Zend_Config $spec, array | \Zend_Config $options = null) : voidConstructor
| Name | Type | Description |
|---|---|---|
| $spec | string | array | \Zend_Config | |
| $options | array | \Zend_Config |
| Exception | Description |
|---|---|
| \Zend_Form_Exception | if no element name after initialization |

__get(string $key) : mixedOverloading: retrieve object property
| Name | Type | Description |
|---|---|---|
| $key | string |
| Type | Description |
|---|---|
| mixed |

__set(string $key, mixed $value) : \voideOverloading: set object property
| Name | Type | Description |
|---|---|---|
| $key | string | |
| $value | mixed |
| Type | Description |
|---|---|
| \voide |

__toString() : stringString representation of form element
| Type | Description |
|---|---|
| string |

_filterValue(string $value, string $key) : voidFilter a value
| Name | Type | Description |
|---|---|---|
| $value | string | |
| $key | string |

_getDecorator(string $name, null | array $options) : \Zend_Form_Decorator_InterfaceInstantiate a decorator based on class name or class name fragment
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $options | null | array |
| Type | Description |
|---|---|
| \Zend_Form_Decorator_Interface |

_getErrorMessages() : arrayRetrieve error messages and perform translation and value substitution
| Type | Description |
|---|---|
| array |

_loadDecorator(array $decorator, mixed $name) : \Zend_Form_Decorator_InterfaceLazy-load a decorator
| Name | Type | Description |
|---|---|---|
| $decorator | array | Decorator type and options |
| $name | mixed | Decorator name or alias |
| Type | Description |
|---|---|
| \Zend_Form_Decorator_Interface |

_loadFilter(array $filter) : \Zend_Filter_InterfaceLazy-load a filter
| Name | Type | Description |
|---|---|---|
| $filter | array |
| Type | Description |
|---|---|
| \Zend_Filter_Interface |

_loadValidator(array $validator) : \Zend_Validate_InterfaceLazy-load a validator
| Name | Type | Description |
|---|---|---|
| $validator | array | Validator definition |
| Type | Description |
|---|---|
| \Zend_Validate_Interface |

addDecorator(string | \Zend_Form_Decorator_Interface $decorator, array | \Zend_Config $options = null) : \Zend_Form_ElementAdd a decorator for rendering the element
| Name | Type | Description |
|---|---|---|
| $decorator | string | \Zend_Form_Decorator_Interface | |
| $options | array | \Zend_Config | Options with which to initialize decorator |
| Type | Description |
|---|---|
| \Zend_Form_Element |

addDecorators(array $decorators) : \Zend_Form_ElementAdd many decorators at once
| Name | Type | Description |
|---|---|---|
| $decorators | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

addError(string $message) : \Zend_Form_ElementAdd an error message and mark element as failed validation
| Name | Type | Description |
|---|---|---|
| $message | string |
| Type | Description |
|---|---|
| \Zend_Form_Element |

addErrorMessage(string $message) : \Zend_Form_ElementAdd a custom error message to return in the event of failed validation
| Name | Type | Description |
|---|---|---|
| $message | string |
| Type | Description |
|---|---|
| \Zend_Form_Element |

addErrorMessages(array $messages) : \Zend_Form_ElementAdd multiple custom error messages to return in the event of failed validation
| Name | Type | Description |
|---|---|---|
| $messages | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

addErrors(array $messages) : \Zend_Form_ElementAdd multiple error messages and flag element as failed validation
| Name | Type | Description |
|---|---|---|
| $messages | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

addFilter(string | \Zend_Filter_Interface $filter, $options = array()) : \Zend_Form_ElementAdd a filter to the element
| Name | Type | Description |
|---|---|---|
| $filter | string | \Zend_Filter_Interface | |
| $options |
| Type | Description |
|---|---|
| \Zend_Form_Element |

addFilters(array $filters) : \Zend_Form_ElementAdd filters to element
| Name | Type | Description |
|---|---|---|
| $filters | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

addPrefixPath(string $prefix, string $path, string $type = null) : \Zend_Form_ElementAdd prefix path for plugin loader
| Name | Type | Description |
|---|---|---|
| $prefix | string | |
| $path | string | |
| $type | string |
| Type | Description |
|---|---|
| \Zend_Form_Element |
| Exception | Description |
|---|---|
| \Zend_Form_Exception | for invalid type |

addPrefixPaths(array $spec) : \Zend_Form_ElementAdd many prefix paths at once
| Name | Type | Description |
|---|---|---|
| $spec | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

addValidator(string | \Zend_Validate_Interface $validator, bool $breakChainOnFailure = false, array $options = array()) : \Zend_Form_ElementAdd validator to validation chain
| Name | Type | Description |
|---|---|---|
| $validator | string | \Zend_Validate_Interface | |
| $breakChainOnFailure | bool | |
| $options | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |
| Exception | Description |
|---|---|
| \Zend_Form_Exception | if invalid validator type |

addValidators(array $validators) : \Zend_Form_ElementAdd multiple validators
| Name | Type | Description |
|---|---|---|
| $validators | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

autoInsertNotEmptyValidator() : boolGet flag indicating whether a NotEmpty validator should be inserted when element is required
| Type | Description |
|---|---|
| bool |

clearErrorMessages() : \Zend_Form_ElementClear custom error messages stack
| Type | Description |
|---|---|
| \Zend_Form_Element |

filterName(string $value, bool $allowBrackets = false) : stringFilter a name to only allow valid variable characters
| Name | Type | Description |
|---|---|---|
| $value | string | |
| $allowBrackets | bool |
| Type | Description |
|---|---|
| string |

getAttrib(string $name) : stringRetrieve element attribute
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| string |

getConcatJustValuesInErrorMessage() : booleanUse one error message for array elements with concatenated values
| Type | Description |
|---|---|
| boolean |

getDecorator(string $name) : false | \Zend_Form_Decorator_AbstractRetrieve a registered decorator
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| false | \Zend_Form_Decorator_Abstract |

getFilter(string $name) : \Zend_Filter_InterfaceRetrieve a single filter by name
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| \Zend_Filter_Interface |

getFullyQualifiedName() : stringGet fully qualified name
| Type | Description |
|---|---|
| string |

getIgnore() : boolGet ignore flag (used when retrieving values at form level)
| Type | Description |
|---|---|
| bool |

getPluginLoader(string $type) : \Zend_Loader_PluginLoaderRetrieve plugin loader for validator or filter chain
| Name | Type | Description |
|---|---|---|
| $type | string |
| Type | Description |
|---|---|
| \Zend_Loader_PluginLoader |
| Exception | Description |
|---|---|
| \Zend_Loader_Exception | on invalid type. |

getTranslator() : \Zend_Translate_Adapter | nullRetrieve localization translator object
| Type | Description |
|---|---|
| \Zend_Translate_Adapter | null |

getValidator(string $name) : \Zend_Validate_Interface | falseRetrieve a single validator by name
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| \Zend_Validate_Interface | false | False if not found, validator otherwise |

getView() : null | \Zend_View_InterfaceRetrieve view object
| Type | Description |
|---|---|
| null | \Zend_View_Interface |

isValid(mixed $value, mixed $context = null) : booleanValidate element value
| Name | Type | Description |
|---|---|---|
| $value | mixed | |
| $context | mixed |
| Type | Description |
|---|---|
| boolean |

loadDefaultDecorators() : \Zend_Form_ElementLoad default decorators
| Type | Description |
|---|---|
| \Zend_Form_Element |

loadDefaultDecoratorsIsDisabled() : boolShould we load the default decorators?
| Type | Description |
|---|---|
| bool |

markAsError() : \Zend_Form_ElementMark the element as being in a failed validation state
| Type | Description |
|---|---|
| \Zend_Form_Element |

removeDecorator(string $name) : \Zend_Form_ElementRemove a single decorator
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| \Zend_Form_Element |

removeFilter(string $name) : \Zend_Form_ElementRemove a filter by name
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| \Zend_Form_Element |

removeValidator(string $name) : boolRemove a single validator by name
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| bool |

render(\Zend_View_Interface $view = null) : stringRender form element
| Name | Type | Description |
|---|---|---|
| $view | \Zend_View_Interface |
| Type | Description |
|---|---|
| string |

resolveElementId(\Zend_Form_Decorator_Interface $decorator) : stringUsed to resolve and return an element ID
| Name | Type | Description |
|---|---|---|
| $decorator | \Zend_Form_Decorator_Interface |
| Type | Description |
|---|---|
| string |

setAllowEmpty(bool $flag) : \Zend_Form_ElementSet 'allow empty' flag
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setAttrib(string $name, mixed $value) : \Zend_Form_ElementSet element attribute
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $value | mixed |
| Type | Description |
|---|---|
| \Zend_Form_Element |
| Exception | Description |
|---|---|
| \Zend_Form_Exception | for invalid $name values |

setAttribs(array $attribs) : \Zend_Form_ElementSet multiple attributes at once
| Name | Type | Description |
|---|---|---|
| $attribs | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setAutoInsertNotEmptyValidator(bool $flag) : \Zend_Form_ElementSet flag indicating whether a NotEmpty validator should be inserted when element is required
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setBelongsTo(string $array) : \Zend_Form_ElementSet array to which element belongs
| Name | Type | Description |
|---|---|---|
| $array | string |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setConcatJustValuesInErrorMessage(boolean $concatJustValuesInErrorMessage) : \Zend_Form_ElementUse one error message for array elements with concatenated values
| Name | Type | Description |
|---|---|---|
| $concatJustValuesInErrorMessage | boolean |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setConfig(\Zend_Config $config) : \Zend_Form_ElementSet object state from Zend_Config object
| Name | Type | Description |
|---|---|---|
| $config | \Zend_Config |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setDecorators(array $decorators) : \Zend_Form_ElementOverwrite all decorators
| Name | Type | Description |
|---|---|---|
| $decorators | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setDescription(string $description) : \Zend_Form_ElementSet element description
| Name | Type | Description |
|---|---|---|
| $description | string |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setDisableLoadDefaultDecorators(bool $flag) : \Zend_Form_ElementSet flag to disable loading default decorators
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setDisableTranslator(bool $flag) : \Zend_Form_ElementIndicate whether or not translation should be disabled
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setErrorMessageSeparator(string $separator) : \Zend_Form_ElementSet errorMessageSeparator
| Name | Type | Description |
|---|---|---|
| $separator | string |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setErrorMessages(array $messages) : \Zend_Form_ElementSame as addErrorMessages(), but clears custom error message stack first
| Name | Type | Description |
|---|---|---|
| $messages | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setErrors(array $messages) : \Zend_Form_ElementOverwrite any previously set error messages and flag as failed validation
| Name | Type | Description |
|---|---|---|
| $messages | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setFilters(array $filters) : \Zend_Form_ElementAdd filters to element, overwriting any already existing
| Name | Type | Description |
|---|---|---|
| $filters | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setIgnore(bool $flag) : \Zend_Form_ElementSet ignore flag (used when retrieving values at form level)
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setIsArray(bool $flag) : \Zend_Form_ElementSet flag indicating if element represents an array
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setLabel(string $label) : \Zend_Form_ElementSet element label
| Name | Type | Description |
|---|---|---|
| $label | string |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setName(string $name) : \Zend_Form_ElementSet element name
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setOptions(array $options) : \Zend_Form_ElementSet object state from options array
| Name | Type | Description |
|---|---|---|
| $options | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setOrder(int $order) : \Zend_Form_ElementSet element order
| Name | Type | Description |
|---|---|---|
| $order | int |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setPluginLoader(\Zend_Loader_PluginLoader_Interface $loader, string $type) : \Zend_Form_ElementSet plugin loader to use for validator or filter chain
| Name | Type | Description |
|---|---|---|
| $loader | \Zend_Loader_PluginLoader_Interface | |
| $type | string | 'decorator', 'filter', or 'validate' |
| Type | Description |
|---|---|
| \Zend_Form_Element |
| Exception | Description |
|---|---|
| \Zend_Form_Exception | on invalid type |

setRequired(bool $flag = true) : \Zend_Form_ElementSet required flag
| Name | Type | Description |
|---|---|---|
| $flag | bool | Default value is true |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setTranslator(\Zend_Translate | null $translator = null) : \Zend_Form_ElementSet translator object for localization
| Name | Type | Description |
|---|---|---|
| $translator | \Zend_Translate | null |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setValidators(array $validators) : \Zend_Form_ElementSet multiple validators, overwriting previous validators
| Name | Type | Description |
|---|---|---|
| $validators | array |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setValue(mixed $value) : \Zend_Form_ElementSet element value
| Name | Type | Description |
|---|---|---|
| $value | mixed |
| Type | Description |
|---|---|
| \Zend_Form_Element |

setView(\Zend_View_Interface $view = null) : \Zend_Form_ElementSet view object
| Name | Type | Description |
|---|---|---|
| $view | \Zend_View_Interface |
| Type | Description |
|---|---|
| \Zend_Form_Element |