Form/Element.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 license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Form
Package: Zend_Form\ElementZend_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
Methods



__call(string $method, array $args) : string
Overloading: allow rendering specific decorators
Call renderDecoratorName() to render a specific decorator.
ParametersName | Type | Description |
---|
$method | string | |
---|
$args | array | |
---|
ReturnsThrows


__get(string $key) : mixed
Overloading: retrieve object property
Prevents access to properties beginning with '_'.
ParametersName | Type | Description |
---|
$key | string | |
---|
Returns


__set(string $key, mixed $value) : \voide
Overloading: set object property
ParametersName | Type | Description |
---|
$key | string | |
---|
$value | mixed | |
---|
Returns 


__toString() : string
String representation of form element
Proxies to {@link render()}.
Returns


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


_loadDecorator(array $decorator, mixed $name) : \Zend_Form_Decorator_Interface
ParametersName | Type | Description |
---|
$decorator | array | Decorator type and options |
---|
$name | mixed | Decorator name or alias |
---|
Returns 


_loadValidator(array $validator) : \Zend_Validate_Interface
ParametersName | Type | Description |
---|
$validator | array | Validator definition |
---|
Returns 


addDecorators(array $decorators) : \Zend_Form_Element
Add many decorators at once
ParametersName | Type | Description |
---|
$decorators | array | |
---|
Returns 


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


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


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


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


addPrefixPath(string $prefix, string $path, string $type = null) : \Zend_Form_Element
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'
- filters: $prefix = $prefix . '_Filter'
- validators: $prefix = $prefix . '_Validate'
Otherwise, the path prefix is set on the appropriate plugin loader.
ParametersName | Type | Description |
---|
$prefix | string | |
---|
$path | string | |
---|
$type | string | |
---|
ReturnsThrows


addPrefixPaths(array $spec) : \Zend_Form_Element
Add many prefix paths at once
ParametersName | Type | Description |
---|
$spec | array | |
---|
Returns 


addValidator(string | \Zend_Validate_Interface $validator, bool $breakChainOnFailure = false, array $options = array()) : \Zend_Form_Element
Add validator to validation chain
Note: will overwrite existing validators if they are of the same class.
ParametersReturnsThrows


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


getAttrib(string $name) : string
Retrieve element attribute
ParametersName | Type | Description |
---|
$name | string | |
---|
Returns 


getFilter(string $name) : \Zend_Filter_Interface
Retrieve a single filter by name
ParametersName | Type | Description |
---|
$name | string | |
---|
Returns 


getPluginLoader(string $type) : \Zend_Loader_PluginLoader
Retrieve plugin loader for validator or filter chain
Instantiates with default rules if none available for that type. Use
'decorator', 'filter', or 'validate' for $type.
ParametersName | Type | Description |
---|
$type | string | |
---|
ReturnsThrows


getValidator(string $name) : \Zend_Validate_Interface | false
Retrieve a single validator by name
ParametersName | Type | Description |
---|
$name | string | |
---|
Returns 


removeDecorator(string $name) : \Zend_Form_Element
Remove a single decorator
ParametersName | Type | Description |
---|
$name | string | |
---|
Returns 


removeValidator(string $name) : bool
Remove a single validator by name
ParametersName | Type | Description |
---|
$name | string | |
---|
Returns 


resolveElementId(\Zend_Form_Decorator_Interface $decorator) : string
staticUsed to resolve and return an element ID
Passed to the HtmlTag decorator as a callback in order to provide an ID.
ParametersReturns


setAttribs(array $attribs) : \Zend_Form_Element
Set multiple attributes at once
ParametersName | Type | Description |
---|
$attribs | array | |
---|
Returns 


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


setBelongsTo(string $array) : \Zend_Form_Element
Set array to which element belongs
ParametersName | Type | Description |
---|
$array | string | |
---|
Returns 


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


setDisableLoadDefaultDecorators(bool $flag) : \Zend_Form_Element
Set flag to disable loading default decorators
ParametersName | Type | Description |
---|
$flag | bool | |
---|
Returns 


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


setErrorMessageSeparator(string $separator) : \Zend_Form_Element
Set errorMessageSeparator
ParametersName | Type | Description |
---|
$separator | string | |
---|
Returns 


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


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


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


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


setIsArray(bool $flag) : \Zend_Form_Element
Set flag indicating if element represents an array
ParametersName | Type | Description |
---|
$flag | bool | |
---|
Returns 


setOptions(array $options) : \Zend_Form_Element
Set object state from options array
ParametersName | Type | Description |
---|
$options | array | |
---|
Returns 


setRequired(bool $flag = true) : \Zend_Form_Element
ParametersName | Type | Description |
---|
$flag | bool | Default value is true |
---|
Returns 


setValidators(array $validators) : \Zend_Form_Element
Set multiple validators, overwriting previous validators
ParametersName | Type | Description |
---|
$validators | array | |
---|
Returns