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_Element
DECORATOR = 'DECORATOR'
Element Constants
FILTER = 'FILTER'
VALIDATE = 'VALIDATE'
bool $_allowEmpty = 'true'
'Allow empty' flag
bool $_autoInsertNotEmptyValidator = 'true'
Flag indicating whether or not to insert NotEmpty validator when element is required
string $_belongsTo = ''
Array to which element belongs
array $_decorators = 'array'
Element decorators
string $_description = ''
Element description
bool $_disableLoadDefaultDecorators = 'false'
Should we disable loading the default decorators?
string $_errorMessageSeparator = '; '
Separator to use when concatenating aggregate error messages (for elements having array values)
array $_errorMessages = 'array'
Custom error messages
array $_errors = 'array'
Validation errors
array $_filters = 'array'
Element filters
bool $_ignore = 'false'
Ignore flag (used when retrieving values at form level)
bool $_isArray = 'false'
Does the element represent an array?
bool $_isError = 'false'
Is the error marked as in an invalid state?
bool $_isErrorForced = 'false'
Has the element been manually marked as invalid?
bool $_isPartialRendering = 'false'
Is a specific decorator being rendered via the magic renderDecorator()?
This is to allow execution of logic inside the render() methods of child elements during the magic call while skipping the parent render() method.
string $_label = ''
Element label
array $_loaders = 'array'
Plugin loaders for filter and validator chains
array $_messages = 'array'
Formatted validation error messages
string $_name = ''
Element name
int $_order = ''
Order of element
bool $_required = 'false'
Required flag
Zend_Translate $_translator = ''
bool $_translatorDisabled = 'false'
Is translation disabled?
string $_type = ''
Element type
array $_validatorRules = 'array'
Array of un-initialized validators
array $_validators = 'array'
Array of initialized validators
mixed $_value = ''
Element value
Zend_View_Interface $_view = ''
string $helper = 'formText'
Default view helper to use
__call(
string $method, array $args
)
:
string
Overloading: allow rendering specific decorators
Call renderDecoratorName() to render a specific decorator.
__construct(
string|array|Zend_Config $spec, array|Zend_Config $options
=
null
)
:
void
Constructor
$spec may be: - string: name of element - array: options with which to configure element - Zend_Config: Zend_Config with options for configuring element
__get(
string $key
)
:
mixed
Overloading: retrieve object property
Prevents access to properties beginning with '_'.
__set(
string $key, mixed $value
)
:
voide
Overloading: set object property
__toString(
)
:
string
String representation of form element
Proxies to {@link render()}.
_filterValue(
string $value, string $key
)
:
void
Filter a value
_getDecorator(
string $name, null|array $options
)
:
Zend_Form_Decorator_Interface
Instantiate a decorator based on class name or class name fragment
_getErrorMessages(
)
:
array
Retrieve error messages and perform translation and value substitution
_hasErrorMessages(
)
:
bool
Are there custom error messages registered?
_loadDecorator(
array $decorator, mixed $name
)
:
Zend_Form_Decorator_Interface
Lazy-load a decorator
_loadFilter(
array $filter
)
:
Zend_Filter_Interface
Lazy-load a filter
_loadValidator(
array $validator
)
:
Zend_Validate_Interface
Lazy-load a validator
addDecorator(
string|Zend_Form_Decorator_Interface $decorator, array|Zend_Config $options
=
null
)
:
Zend_Form_Element
Add a decorator for rendering the element
addDecorators(
array $decorators
)
:
Zend_Form_Element
Add many decorators at once
addError(
string $message
)
:
Zend_Form_Element
Add an error message and mark element as failed validation
addErrorMessage(
string $message
)
:
Zend_Form_Element
Add a custom error message to return in the event of failed validation
addErrorMessages(
array $messages
)
:
Zend_Form_Element
Add multiple custom error messages to return in the event of failed validation
addErrors(
array $messages
)
:
Zend_Form_Element
Add multiple error messages and flag element as failed validation
addFilter(
string|Zend_Filter_Interface $filter, $options
=
array
)
:
Zend_Form_Element
Add a filter to the element
addFilters(
array $filters
)
:
Zend_Form_Element
Add filters to element
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.
addPrefixPaths(
array $spec
)
:
Zend_Form_Element
Add many prefix paths at once
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.
addValidators(
array $validators
)
:
Zend_Form_Element
Add multiple validators
autoInsertNotEmptyValidator(
)
:
bool
Get flag indicating whether a NotEmpty validator should be inserted when element is required
clearDecorators(
)
:
Zend_Form_Element
Clear all decorators
clearErrorMessages(
)
:
Zend_Form_Element
Clear custom error messages stack
clearFilters(
)
:
Zend_Form_Element
Clear all filters
clearValidators(
)
:
Zend_Form_Element
Clear all validators
filterName(
string $value, bool $allowBrackets
=
false
)
:
string
Filter a name to only allow valid variable characters
getAllowEmpty(
)
:
bool
Get 'allow empty' flag
getAttrib(
string $name
)
:
string
Retrieve element attribute
getAttribs(
)
:
array
Return all attributes
getBelongsTo(
)
:
string
Return array name to which element belongs
getDecorator(
string $name
)
:
false|Zend_Form_Decorator_Abstract
Retrieve a registered decorator
getDecorators(
)
:
array
Retrieve all decorators
getDescription(
)
:
string
Retrieve element description
getErrorMessageSeparator(
)
:
string
Get errorMessageSeparator
getErrorMessages(
)
:
array
Retrieve custom error messages
getErrors(
)
:
array
Retrieve validator chain errors
getFilter(
string $name
)
:
Zend_Filter_Interface
Retrieve a single filter by name
getFilters(
)
:
array
Get all filters
getFullyQualifiedName(
)
:
string
Get fully qualified name
Places name as subitem of array and/or appends brackets.
getId(
)
:
string
Get element id
getIgnore(
)
:
bool
Get ignore flag (used when retrieving values at form level)
getLabel(
)
:
string
Retrieve element label
getMessages(
)
:
array
Retrieve error messages
getName(
)
:
string
Return element name
getOrder(
)
:
int
Retrieve element order
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.
getTranslator(
)
:
Zend_Translate_Adapter|null
Retrieve localization translator object
getType(
)
:
string
Return element type
getUnfilteredValue(
)
:
mixed
Retrieve unfiltered element value
getValidator(
string $name
)
:
Zend_Validate_Interface|false
Retrieve a single validator by name
getValidators(
)
:
array
Retrieve all validators
getValue(
)
:
mixed
Retrieve filtered element value
getView(
)
:
null|Zend_View_Interface
Retrieve view object
Retrieves from ViewRenderer if none previously set.
hasErrors(
)
:
bool
Are there errors registered?
hasTranslator(
)
:
bool
Does this element have its own specific translator?
init(
)
:
void
Initialize object; used by extending classes
isArray(
)
:
bool
Is the element representing an array?
isRequired(
)
:
bool
Is the element required?
isValid(
mixed $value, mixed $context
=
null
)
:
boolean
Validate element value
If a translation adapter is registered, any error messages will be translated according to the current locale, using the given error code; if no matching translation is found, the original message will be utilized.
Note: The filtered value is validated.
loadDefaultDecorators(
)
:
Zend_Form_Element
Load default decorators
loadDefaultDecoratorsIsDisabled(
)
:
bool
Should we load the default decorators?
markAsError(
)
:
Zend_Form_Element
Mark the element as being in a failed validation state
removeDecorator(
string $name
)
:
Zend_Form_Element
Remove a single decorator
removeFilter(
string $name
)
:
Zend_Form_Element
Remove a filter by name
removeValidator(
string $name
)
:
bool
Remove a single validator by name
render(
Zend_View_Interface $view
=
null
)
:
string
Render form element
setAllowEmpty(
bool $flag
)
:
Zend_Form_Element
Set 'allow empty' flag
When the allow empty flag is enabled and the required flag is false, the element will validate with empty values.
setAttrib(
string $name, mixed $value
)
:
Zend_Form_Element
Set element attribute
setAttribs(
array $attribs
)
:
Zend_Form_Element
Set multiple attributes at once
setAutoInsertNotEmptyValidator(
bool $flag
)
:
Zend_Form_Element
Set flag indicating whether a NotEmpty validator should be inserted when element is required
setBelongsTo(
string $array
)
:
Zend_Form_Element
Set array to which element belongs
setConfig(
Zend_Config $config
)
:
Zend_Form_Element
Set object state from Zend_Config object
setDecorators(
array $decorators
)
:
Zend_Form_Element
Overwrite all decorators
setDescription(
string $description
)
:
Zend_Form_Element
Set element description
setDisableLoadDefaultDecorators(
bool $flag
)
:
Zend_Form_Element
Set flag to disable loading default decorators
setDisableTranslator(
bool $flag
)
:
Zend_Form_Element
Indicate whether or not translation should be disabled
setErrorMessageSeparator(
string $separator
)
:
Zend_Form_Element
Set errorMessageSeparator
setErrorMessages(
array $messages
)
:
Zend_Form_Element
Same as addErrorMessages(), but clears custom error message stack first
setErrors(
array $messages
)
:
Zend_Form_Element
Overwrite any previously set error messages and flag as failed validation
setFilters(
array $filters
)
:
Zend_Form_Element
Add filters to element, overwriting any already existing
setIgnore(
bool $flag
)
:
Zend_Form_Element
Set ignore flag (used when retrieving values at form level)
setIsArray(
bool $flag
)
:
Zend_Form_Element
Set flag indicating if element represents an array
setLabel(
string $label
)
:
Zend_Form_Element
Set element label
setName(
string $name
)
:
Zend_Form_Element
Set element name
setOptions(
array $options
)
:
Zend_Form_Element
Set object state from options array
setOrder(
int $order
)
:
Zend_Form_Element
Set element order
setPluginLoader(
Zend_Loader_PluginLoader_Interface $loader, string $type
)
:
Zend_Form_Element
Set plugin loader to use for validator or filter chain
setRequired(
bool $flag
=
true
)
:
Zend_Form_Element
Set required flag
setTranslator(
Zend_Translate|null $translator
=
null
)
:
Zend_Form_Element
Set translator object for localization
setValidators(
array $validators
)
:
Zend_Form_Element
Set multiple validators, overwriting previous validators
setValue(
mixed $value
)
:
Zend_Form_Element
Set element value
setView(
Zend_View_Interface $view
=
null
)
:
Zend_Form_Element
Set view object
translatorIsDisabled(
)
:
bool
Is translation disabled?