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

integer
$_maxFileSize= ''

boolean
$_valueDisabled= 'false'
false
Details
__call(
string $method, array $args
)
:
string
Overloading: allow rendering specific decorators
Inherited from: \Zend_Form_Element::__call()Call renderDecoratorName() to render a specific decorator.
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
)
:
void
Constructor
Inherited from: \Zend_Form_Element::__construct()$spec may be: - string: name of element - array: options with which to configure element - Zend_Config: Zend_Config with options for configuring element
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
)
:
mixed
Overloading: retrieve object property
Inherited from: \Zend_Form_Element::__get()Prevents access to properties beginning with '_'.
Name | Type | Description |
---|---|---|
$key | string |
Type | Description |
---|---|
mixed |

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

__toString(
)
:
string
String representation of form element
Inherited from: \Zend_Form_Element::__toString()Proxies to {@link render()}.
Type | Description |
---|---|
string |

_convertIniToInteger(
string $setting
)
:
integer
Converts a ini setting to a integer value
Name | Type | Description |
---|---|---|
$setting | string |
Type | Description |
---|---|
integer |

_filterValue(
string $value, string $key
)
:
void
Filter a value
Inherited from: \Zend_Form_Element::_filterValue()Name | Type | Description |
---|---|---|
$value | string | |
$key | string |

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

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

_hasErrorMessages(
)
:
bool
Are there custom error messages registered?
Inherited from: \Zend_Form_Element::_hasErrorMessages()Type | Description |
---|---|
bool |

_loadDecorator(
array $decorator, mixed $name
)
:
\Zend_Form_Decorator_Interface
Lazy-load a decorator
Inherited from: \Zend_Form_Element::_loadDecorator()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_Interface
Lazy-load a filter
Inherited from: \Zend_Form_Element::_loadFilter()
_loadValidator(
array $validator
)
:
\Zend_Validate_Interface
Lazy-load a validator
Inherited from: \Zend_Form_Element::_loadValidator()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_Element
Add a decorator for rendering the element
Inherited from: \Zend_Form_Element::addDecorator()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_Element
Add many decorators at once
Inherited from: \Zend_Form_Element::addDecorators()
addError(
string $message
)
:
\Zend_Form_Element
Add an error message and mark element as failed validation
Inherited from: \Zend_Form_Element::addError()
addErrorMessage(
string $message
)
:
\Zend_Form_Element
Add a custom error message to return in the event of failed validation
Inherited from: \Zend_Form_Element::addErrorMessage()
addErrorMessages(
array $messages
)
:
\Zend_Form_Element
Add multiple custom error messages to return in the event of failed validation
Inherited from: \Zend_Form_Element::addErrorMessages()
addErrors(
array $messages
)
:
\Zend_Form_Element
Add multiple error messages and flag element as failed validation
Inherited from: \Zend_Form_Element::addErrors()
addFilter(
string|array $filter, string|array $options
=
null
)
:
\Zend_Form_Element_File
Add Filter; proxy to adapter
Name | Type | Description |
---|---|---|
$filter | string|array | Type of filter to add |
$options | string|array | Options to set for the filter |
Type | Description |
---|---|
\Zend_Form_Element_File |

addFilters(
array $filters
)
:
\Zend_Form_Element_File
Add Multiple filters at once; proxy to adapter

addPrefixPath(
string $prefix, string $path, string $type
=
null
)
:
\Zend_Form_Element_File
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.
Name | Type | Description |
---|---|---|
$prefix | string | |
$path | string | |
$type | string |
Type | Description |
---|---|
\Zend_Form_Element_File |
Exception | Description |
---|---|
\Zend_Form_Exception | for invalid type |

addPrefixPaths(
array $spec
)
:
\Zend_Form_Element
Add many prefix paths at once
Inherited from: \Zend_Form_Element::addPrefixPaths()
addValidator(
string|\Zend_Validate_Interface $validator, bool $breakChainOnFailure
=
false, mixed $options
=
array
)
:
\Zend_Form_Element_File
Add Validator; proxy to adapter
Note: will overwrite existing validators if they are of the same class.
Name | Type | Description |
---|---|---|
$validator | string|\Zend_Validate_Interface | |
$breakChainOnFailure | bool | |
$options | mixed |
Type | Description |
---|---|
\Zend_Form_Element_File |
Exception | Description |
---|---|
\Zend_Form_Exception | if invalid validator type |

addValidators(
array $validators
)
:
\Zend_Form_Element_File
Add multiple validators at once; proxy to adapter

autoInsertNotEmptyValidator(
)
:
bool
Get flag indicating whether a NotEmpty validator should be inserted when element is required
Inherited from: \Zend_Form_Element::autoInsertNotEmptyValidator()Type | Description |
---|---|
bool |

clearDecorators(
)
:
\Zend_Form_Element
Clear all decorators
Inherited from: \Zend_Form_Element::clearDecorators()Type | Description |
---|---|
\Zend_Form_Element |

clearErrorMessages(
)
:
\Zend_Form_Element
Clear custom error messages stack
Inherited from: \Zend_Form_Element::clearErrorMessages()Type | Description |
---|---|
\Zend_Form_Element |

clearFilters(
)
:
\Zend_Form_Element_File
Remove all filters; proxy to adapter
Type | Description |
---|---|
\Zend_Form_Element_File |

clearValidators(
)
:
\Zend_Form_Element_File
Remove all validators; proxy to adapter
Type | Description |
---|---|
\Zend_Form_Element_File |

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

getAllowEmpty(
)
:
bool
Get 'allow empty' flag
Inherited from: \Zend_Form_Element::getAllowEmpty()Type | Description |
---|---|
bool |

getAttrib(
string $name
)
:
string
Retrieve element attribute
Inherited from: \Zend_Form_Element::getAttrib()Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
string |

getAttribs(
)
:
array
Return all attributes
Inherited from: \Zend_Form_Element::getAttribs()Type | Description |
---|---|
array |

getBelongsTo(
)
:
string
Return array name to which element belongs
Inherited from: \Zend_Form_Element::getBelongsTo()Type | Description |
---|---|
string |

getDecorator(
string $name
)
:
false|\Zend_Form_Decorator_Abstract
Retrieve a registered decorator
Inherited from: \Zend_Form_Element::getDecorator()Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
false\Zend_Form_Decorator_Abstract |

getDecorators(
)
:
array
Retrieve all decorators
Inherited from: \Zend_Form_Element::getDecorators()Type | Description |
---|---|
array |

getDescription(
)
:
string
Retrieve element description
Inherited from: \Zend_Form_Element::getDescription()Type | Description |
---|---|
string |

getErrorMessageSeparator(
)
:
string
Get errorMessageSeparator
Inherited from: \Zend_Form_Element::getErrorMessageSeparator()Type | Description |
---|---|
string |

getErrorMessages(
)
:
array
Retrieve custom error messages
Inherited from: \Zend_Form_Element::getErrorMessages()Type | Description |
---|---|
array |

getFileInfo(
string $value
=
null
)
:
array
Get internal file informations
Name | Type | Description |
---|---|---|
$value | string | (Optional) Element or file to return |
Type | Description |
---|---|
array |

getFileName(
string $value
=
null, boolean $path
=
true
)
:
string
Get the final filename
Name | Type | Description |
---|---|---|
$value | string | (Optional) Element or file to return |
$path | boolean | (Optional) Return also the path, defaults to true |
Type | Description |
---|---|
string |

getFileSize(
)
:
string|array
Returns the filesize for this file element
Type | Description |
---|---|
stringarray | Filesize |

getFilters(
)
:
array
Returns all set filters; proxy to adapter
Type | Description |
---|---|
array | List of set filters |

getFullyQualifiedName(
)
:
string
Get fully qualified name
Inherited from: \Zend_Form_Element::getFullyQualifiedName()Places name as subitem of array and/or appends brackets.
Type | Description |
---|---|
string |

getHash(
string $hash
=
crc32
)
:
string|array
Returns the hash for this file element
Name | Type | Description |
---|---|---|
$hash | string | (Optional) Hash algorithm to use |
Type | Description |
---|---|
stringarray | Hashstring |

getId(
)
:
string
Get element id
Inherited from: \Zend_Form_Element::getId()Type | Description |
---|---|
string |

getIgnore(
)
:
bool
Get ignore flag (used when retrieving values at form level)
Inherited from: \Zend_Form_Element::getIgnore()Type | Description |
---|---|
bool |

getLabel(
)
:
string
Retrieve element label
Inherited from: \Zend_Form_Element::getLabel()Type | Description |
---|---|
string |

getMessages(
)
:
array
Retrieve error messages; proxy to transfer adapter
If isValid() was never called or if the most recent isValid() call returned true, then this method returns an empty array.
Type | Description |
---|---|
array |

getMimeType(
)
:
string|array
Returns the mimetype for this file element
Type | Description |
---|---|
stringarray | Mimetype |

getName(
)
:
string
Return element name
Inherited from: \Zend_Form_Element::getName()Type | Description |
---|---|
string |

getOrder(
)
:
int
Retrieve element order
Inherited from: \Zend_Form_Element::getOrder()Type | Description |
---|---|
int |

getPluginLoader(
string $type
)
:
\Zend_Loader_PluginLoader_Interface
Get Plugin Loader
Instantiates with default rules if none available for that type. Use 'decorator', 'filter', or 'validate' for $type.
Name | Type | Description |
---|---|---|
$type | string |
Type | Description |
---|---|
\Zend_Loader_PluginLoader_Interface |
Exception | Description |
---|---|
\Zend_Loader_Exception | on invalid type. |

getTransferAdapter(
)
:
\Zend_File_Transfer_Adapter_Abstract
Get transfer adapter
Lazy loads HTTP transfer adapter when no adapter registered.
Type | Description |
---|---|
\Zend_File_Transfer_Adapter_Abstract |

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

getType(
)
:
string
Return element type
Inherited from: \Zend_Form_Element::getType()Type | Description |
---|---|
string |

getUnfilteredValue(
)
:
mixed
Retrieve unfiltered element value
Inherited from: \Zend_Form_Element::getUnfilteredValue()Type | Description |
---|---|
mixed |

getValidator(
string $name
)
:
\Zend_Validate_Interface|null
Retrieve validator by name; proxy to adapter

getValue(
)
:
null|string
Processes the file, returns null or the filename only For the complete path, use getFileName
Type | Description |
---|---|
nullstring |

getView(
)
:
null|\Zend_View_Interface
Retrieve view object
Inherited from: \Zend_Form_Element::getView()Retrieves from ViewRenderer if none previously set.
Type | Description |
---|---|
null\Zend_View_Interface |

hasTranslator(
)
:
bool
Does this element have its own specific translator?
Inherited from: \Zend_Form_Element::hasTranslator()Type | Description |
---|---|
bool |

init(
)
:
void
Initialize object; used by extending classes
Inherited from: \Zend_Form_Element::init()
isArray(
)
:
bool
Is the element representing an array?
Inherited from: \Zend_Form_Element::isArray()Type | Description |
---|---|
bool |

isRequired(
)
:
bool
Is the element required?
Inherited from: \Zend_Form_Element::isRequired()Type | Description |
---|---|
bool |

isValid(
string $value, mixed $context
=
null
)
:
bool
Validate upload
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.
Name | Type | Description |
---|---|---|
$value | string | File, can be optional, give null to validate all files |
$context | mixed |
Type | Description |
---|---|
bool |
Exception | Description |
---|---|
\Zend_Validate_Exception | If validation of $value is impossible |

isValueDisabled(
)
:
boolean
Returns if the file will be uploaded when calling getValues()
Type | Description |
---|---|
boolean | Receive the file on calling getValues()? |

loadDefaultDecorators(
)
:
\Zend_Form_Element_File
Load default decorators
Type | Description |
---|---|
\Zend_Form_Element_File |

loadDefaultDecoratorsIsDisabled(
)
:
bool
Should we load the default decorators?
Inherited from: \Zend_Form_Element::loadDefaultDecoratorsIsDisabled()Type | Description |
---|---|
bool |

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

removeDecorator(
string $name
)
:
\Zend_Form_Element
Remove a single decorator
Inherited from: \Zend_Form_Element::removeDecorator()
render(
\Zend_View_Interface $view
=
null
)
:
string
Render form element Checks for decorator interface to prevent errors

resolveElementId(
\Zend_Form_Decorator_Interface $decorator
)
:
string
Used to resolve and return an element ID
Inherited from: \Zend_Form_Element::resolveElementId()Passed to the HtmlTag decorator as a callback in order to provide an ID.
Name | Type | Description |
---|---|---|
$decorator | \Zend_Form_Decorator_Interface |
Type | Description |
---|---|
string |

setAllowEmpty(
bool $flag
)
:
\Zend_Form_Element
Set 'allow empty' flag
Inherited from: \Zend_Form_Element::setAllowEmpty()When the allow empty flag is enabled and the required flag is false, the element will validate with empty values.
Name | Type | Description |
---|---|---|
$flag | bool |
Type | Description |
---|---|
\Zend_Form_Element |

setAttrib(
string $name, mixed $value
)
:
\Zend_Form_Element
Set element attribute
Inherited from: \Zend_Form_Element::setAttrib()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_Element
Set multiple attributes at once
Inherited from: \Zend_Form_Element::setAttribs()
setAutoInsertNotEmptyValidator(
bool $flag
)
:
\Zend_Form_Element
Set flag indicating whether a NotEmpty validator should be inserted when element is required
Inherited from: \Zend_Form_Element::setAutoInsertNotEmptyValidator()
setBelongsTo(
string $array
)
:
\Zend_Form_Element
Set array to which element belongs
Inherited from: \Zend_Form_Element::setBelongsTo()
setConfig(
\Zend_Config $config
)
:
\Zend_Form_Element
Set object state from Zend_Config object
Inherited from: \Zend_Form_Element::setConfig()
setDecorators(
array $decorators
)
:
\Zend_Form_Element
Overwrite all decorators
Inherited from: \Zend_Form_Element::setDecorators()
setDescription(
string $description
)
:
\Zend_Form_Element
Set element description
Inherited from: \Zend_Form_Element::setDescription()
setDisableLoadDefaultDecorators(
bool $flag
)
:
\Zend_Form_Element
Set flag to disable loading default decorators
Inherited from: \Zend_Form_Element::setDisableLoadDefaultDecorators()
setDisableTranslator(
bool $flag
)
:
\Zend_Form_Element_File
Indicate whether or not translation should be disabled

setErrorMessageSeparator(
string $separator
)
:
\Zend_Form_Element
Set errorMessageSeparator
Inherited from: \Zend_Form_Element::setErrorMessageSeparator()
setErrorMessages(
array $messages
)
:
\Zend_Form_Element
Same as addErrorMessages(), but clears custom error message stack first
Inherited from: \Zend_Form_Element::setErrorMessages()
setErrors(
array $messages
)
:
\Zend_Form_Element
Overwrite any previously set error messages and flag as failed validation
Inherited from: \Zend_Form_Element::setErrors()
setFilters(
$filters
)
:
\Zend_Form_Element_File
Sets a filter for the class, erasing all previous set; proxy to adapter

setIgnore(
bool $flag
)
:
\Zend_Form_Element
Set ignore flag (used when retrieving values at form level)
Inherited from: \Zend_Form_Element::setIgnore()
setIsArray(
bool $flag
)
:
\Zend_Form_Element
Set flag indicating if element represents an array
Inherited from: \Zend_Form_Element::setIsArray()
setLabel(
string $label
)
:
\Zend_Form_Element
Set element label
Inherited from: \Zend_Form_Element::setLabel()
setMaxFileSize(
integer $size
)
:
integer
Sets the maximum file size of the form
Name | Type | Description |
---|---|---|
$size | integer |
Type | Description |
---|---|
integer |

setMultiFile(
integer $count
)
:
\Zend_Form_Element_File
Set a multifile element
Name | Type | Description |
---|---|---|
$count | integer | Number of file elements |
Type | Description |
---|---|
\Zend_Form_Element_File | Provides fluent interface |

setName(
string $name
)
:
\Zend_Form_Element
Set element name
Inherited from: \Zend_Form_Element::setName()
setOptions(
array $options
)
:
\Zend_Form_Element
Set object state from options array
Inherited from: \Zend_Form_Element::setOptions()
setOrder(
int $order
)
:
\Zend_Form_Element
Set element order
Inherited from: \Zend_Form_Element::setOrder()
setPluginLoader(
\Zend_Loader_PluginLoader_Interface $loader, string $type
)
:
\Zend_Form_Element_File
Set plugin loader
Name | Type | Description |
---|---|---|
$loader | \Zend_Loader_PluginLoader_Interface | |
$type | string |
Type | Description |
---|---|
\Zend_Form_Element_File |
Exception | Description |
---|---|
\Zend_Form_Exception | on invalid type |

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

setTransferAdapter(
string|\Zend_File_Transfer_Adapter_Abstract $adapter
)
:
\Zend_Form_Element_File
Set transfer adapter
Name | Type | Description |
---|---|---|
$adapter | string|\Zend_File_Transfer_Adapter_Abstract |
Type | Description |
---|---|
\Zend_Form_Element_File |

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

setValidators(
array $validators
)
:
\Zend_Form_Element_File
Add multiple validators at once, overwriting; proxy to adapter

setValueDisabled(
boolean $flag
)
:
\Zend_Form_Element_File
Set if the file will be uploaded when getting the value This defaults to false which will force receive() when calling getValues()
Name | Type | Description |
---|---|---|
$flag | boolean | Sets if the file is handled as the elements value |
Type | Description |
---|---|
\Zend_Form_Element_File |

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