Zend Framework
1.12
|
Public Member Functions | |
__construct ($spec, $options=null) | |
Constructor. | |
init () | |
Initialize object; used by extending classes. | |
setDisableLoadDefaultDecorators ($flag) | |
Set flag to disable loading default decorators. | |
loadDefaultDecoratorsIsDisabled () | |
Should we load the default decorators? | |
loadDefaultDecorators () | |
Load default decorators. | |
setOptions (array $options) | |
Set object state from options array. | |
setConfig (Zend_Config $config) | |
Set object state from Zend_Config object. | |
setTranslator ($translator=null) | |
Set translator object for localization. | |
getTranslator () | |
Retrieve localization translator object. | |
hasTranslator () | |
Does this element have its own specific translator? | |
setDisableTranslator ($flag) | |
Indicate whether or not translation should be disabled. | |
translatorIsDisabled () | |
Is translation disabled? | |
filterName ($value, $allowBrackets=false) | |
Filter a name to only allow valid variable characters. | |
setName ($name) | |
Set element name. | |
getName () | |
Return element name. | |
getFullyQualifiedName () | |
Get fully qualified name. | |
getId () | |
Get element id. | |
setValue ($value) | |
Set element value. | |
getValue () | |
Retrieve filtered element value. | |
getUnfilteredValue () | |
Retrieve unfiltered element value. | |
setLabel ($label) | |
Set element label. | |
getLabel () | |
Retrieve element label. | |
setOrder ($order) | |
Set element order. | |
getOrder () | |
Retrieve element order. | |
setRequired ($flag=true) | |
Set required flag. | |
isRequired () | |
Is the element required? | |
setAutoInsertNotEmptyValidator ($flag) | |
Set flag indicating whether a NotEmpty validator should be inserted when element is required. | |
autoInsertNotEmptyValidator () | |
Get flag indicating whether a NotEmpty validator should be inserted when element is required. | |
setDescription ($description) | |
Set element description. | |
getDescription () | |
Retrieve element description. | |
setAllowEmpty ($flag) | |
Set 'allow empty' flag. | |
getAllowEmpty () | |
Get 'allow empty' flag. | |
setIgnore ($flag) | |
Set ignore flag (used when retrieving values at form level) | |
getIgnore () | |
Get ignore flag (used when retrieving values at form level) | |
setIsArray ($flag) | |
Set flag indicating if element represents an array. | |
isArray () | |
Is the element representing an array? | |
setBelongsTo ($array) | |
Set array to which element belongs. | |
getBelongsTo () | |
Return array name to which element belongs. | |
getType () | |
Return element type. | |
setAttrib ($name, $value) | |
Set element attribute. | |
setAttribs (array $attribs) | |
Set multiple attributes at once. | |
getAttrib ($name) | |
Retrieve element attribute. | |
getAttribs () | |
Return all attributes. | |
setConcatJustValuesInErrorMessage ($concatJustValuesInErrorMessage) | |
Use one error message for array elements with concatenated values. | |
getConcatJustValuesInErrorMessage () | |
Use one error message for array elements with concatenated values. | |
__get ($key) | |
Overloading: retrieve object property. | |
__set ($key, $value) | |
Overloading: set object property. | |
__call ($method, $args) | |
Overloading: allow rendering specific decorators. | |
setPluginLoader (Zend_Loader_PluginLoader_Interface $loader, $type) | |
Set plugin loader to use for validator or filter chain. | |
getPluginLoader ($type) | |
Retrieve plugin loader for validator or filter chain. | |
addPrefixPath ($prefix, $path, $type=null) | |
Add prefix path for plugin loader. | |
addPrefixPaths (array $spec) | |
Add many prefix paths at once. | |
addValidator ($validator, $breakChainOnFailure=false, $options=array()) | |
Add validator to validation chain. | |
addValidators (array $validators) | |
Add multiple validators. | |
setValidators (array $validators) | |
Set multiple validators, overwriting previous validators. | |
getValidator ($name) | |
Retrieve a single validator by name. | |
getValidators () | |
Retrieve all validators. | |
removeValidator ($name) | |
Remove a single validator by name. | |
clearValidators () | |
Clear all validators. | |
isValid ($value, $context=null) | |
Validate element value. | |
addErrorMessage ($message) | |
Add a custom error message to return in the event of failed validation. | |
addErrorMessages (array $messages) | |
Add multiple custom error messages to return in the event of failed validation. | |
setErrorMessages (array $messages) | |
Same as addErrorMessages(), but clears custom error message stack first. | |
getErrorMessages () | |
Retrieve custom error messages. | |
clearErrorMessages () | |
Clear custom error messages stack. | |
getErrorMessageSeparator () | |
Get errorMessageSeparator. | |
setErrorMessageSeparator ($separator) | |
Set errorMessageSeparator. | |
markAsError () | |
Mark the element as being in a failed validation state. | |
addError ($message) | |
Add an error message and mark element as failed validation. | |
addErrors (array $messages) | |
Add multiple error messages and flag element as failed validation. | |
setErrors (array $messages) | |
Overwrite any previously set error messages and flag as failed validation. | |
hasErrors () | |
Are there errors registered? | |
getErrors () | |
Retrieve validator chain errors. | |
getMessages () | |
Retrieve error messages. | |
addFilter ($filter, $options=array()) | |
Add a filter to the element. | |
addFilters (array $filters) | |
Add filters to element. | |
setFilters (array $filters) | |
Add filters to element, overwriting any already existing. | |
getFilter ($name) | |
Retrieve a single filter by name. | |
getFilters () | |
Get all filters. | |
removeFilter ($name) | |
Remove a filter by name. | |
clearFilters () | |
Clear all filters. | |
setView (Zend_View_Interface $view=null) | |
Set view object. | |
getView () | |
Retrieve view object. | |
addDecorator ($decorator, $options=null) | |
Add a decorator for rendering the element. | |
addDecorators (array $decorators) | |
Add many decorators at once. | |
setDecorators (array $decorators) | |
Overwrite all decorators. | |
getDecorator ($name) | |
Retrieve a registered decorator. | |
getDecorators () | |
Retrieve all decorators. | |
removeDecorator ($name) | |
Remove a single decorator. | |
clearDecorators () | |
Clear all decorators. | |
render (Zend_View_Interface $view=null) | |
Render form element. | |
__toString () | |
String representation of form element. | |
![]() | |
isValid ($value) | |
Returns true if and only if $value meets the validation requirements. | |
Static Public Member Functions | |
static | resolveElementId (Zend_Form_Decorator_Interface $decorator) |
Used to resolve and return an element ID. | |
Public Attributes | |
const | DECORATOR = 'DECORATOR' |
Element Constants. | |
const | FILTER = 'FILTER' |
const | VALIDATE = 'VALIDATE' |
$helper = 'formText' | |
Protected Member Functions | |
_filterValue (&$value, &$key) | |
Filter a value. | |
_getDecorator ($name, $options) | |
Instantiate a decorator based on class name or class name fragment. | |
_loadFilter (array $filter) | |
Lazy-load a filter. | |
_loadValidator (array $validator) | |
Lazy-load a validator. | |
_loadDecorator (array $decorator, $name) | |
Lazy-load a decorator. | |
_getErrorMessages () | |
Retrieve error messages and perform translation and value substitution. | |
_hasErrorMessages () | |
Are there custom error messages registered? | |
Protected Attributes | |
$_allowEmpty = true | |
$_autoInsertNotEmptyValidator = true | |
$_belongsTo | |
$_decorators = array() | |
$_description | |
$_disableLoadDefaultDecorators = false | |
$_errorMessages = array() | |
$_errors = array() | |
$_errorMessageSeparator = '; ' | |
$_filters = array() | |
$_ignore = false | |
$_isArray = false | |
$_isError = false | |
$_isErrorForced = false | |
$_label | |
$_loaders = array() | |
$_messages = array() | |
$_name | |
$_order | |
$_required = false | |
$_translator | |
$_translatorDisabled = false | |
$_type | |
$_validators = array() | |
$_validatorRules = array() | |
$_value | |
$_view | |
$_isPartialRendering = false | |
$_concatJustValuesInErrorMessage = false | |
__construct | ( | $spec, | |
$options = null |
|||
) |
Constructor.
$spec may be:
string | array | Zend_Config | $spec | |
array | Zend_Config | $options |
Zend_Form_Exception | if no element name after initialization |
Extensions
Register ViewHelper decorator by default
__call | ( | $method, | |
$args | |||
) |
Overloading: allow rendering specific decorators.
Call renderDecoratorName() to render a specific decorator.
string | $method | |
array | $args |
Zend_Form_Exception | for invalid decorator or invalid method call |
__get | ( | $key | ) |
Overloading: retrieve object property.
Prevents access to properties beginning with '_'.
string | $key |
__set | ( | $key, | |
$value | |||
) |
Overloading: set object property.
string | $key | |
mixed | $value |
__toString | ( | ) |
|
protected |
Filter a value.
string | $value | |
string | $key |
|
protected |
Instantiate a decorator based on class name or class name fragment.
string | $name | |
null | array | $options |
|
protected |
Retrieve error messages and perform translation and value substitution.
|
protected |
Are there custom error messages registered?
|
protected |
Lazy-load a decorator.
array | $decorator | Decorator type and options |
mixed | $name | Decorator name or alias |
|
protected |
|
protected |
Lazy-load a validator.
array | $validator | Validator definition |
addDecorator | ( | $decorator, | |
$options = null |
|||
) |
Add a decorator for rendering the element.
string | Zend_Form_Decorator_Interface | $decorator | |
array | Zend_Config | $options | Options with which to initialize decorator |
addDecorators | ( | array | $decorators | ) |
addError | ( | $message | ) |
Add an error message and mark element as failed validation.
string | $message |
addErrorMessage | ( | $message | ) |
Add a custom error message to return in the event of failed validation.
string | $message |
addErrorMessages | ( | array | $messages | ) |
Add multiple custom error messages to return in the event of failed validation.
array | $messages |
addErrors | ( | array | $messages | ) |
Add multiple error messages and flag element as failed validation.
array | $messages |
addFilter | ( | $filter, | |
$options = array() |
|||
) |
Add a filter to the element.
string | Zend_Filter_Interface | $filter |
addFilters | ( | array | $filters | ) |
addPrefixPath | ( | $prefix, | |
$path, | |||
$type = null |
|||
) |
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:
Otherwise, the path prefix is set on the appropriate plugin loader.
string | $prefix | |
string | $path | |
string | $type |
Zend_Form_Exception | for invalid type |
addPrefixPaths | ( | array | $spec | ) |
addValidator | ( | $validator, | |
$breakChainOnFailure = false , |
|||
$options = array() |
|||
) |
Add validator to validation chain.
Note: will overwrite existing validators if they are of the same class.
string | Zend_Validate_Interface | $validator | |
bool | $breakChainOnFailure | |
array | $options |
Zend_Form_Exception | if invalid validator type |
addValidators | ( | array | $validators | ) |
autoInsertNotEmptyValidator | ( | ) |
Get flag indicating whether a NotEmpty validator should be inserted when element is required.
clearDecorators | ( | ) |
Clear all decorators.
clearErrorMessages | ( | ) |
Clear custom error messages stack.
clearFilters | ( | ) |
Clear all filters.
clearValidators | ( | ) |
Clear all validators.
filterName | ( | $value, | |
$allowBrackets = false |
|||
) |
Filter a name to only allow valid variable characters.
string | $value | |
bool | $allowBrackets |
getAllowEmpty | ( | ) |
Get 'allow empty' flag.
getAttrib | ( | $name | ) |
Retrieve element attribute.
string | $name |
getAttribs | ( | ) |
Return all attributes.
getBelongsTo | ( | ) |
Return array name to which element belongs.
getConcatJustValuesInErrorMessage | ( | ) |
Use one error message for array elements with concatenated values.
getDecorator | ( | $name | ) |
Retrieve a registered decorator.
string | $name |
getDecorators | ( | ) |
Retrieve all decorators.
getDescription | ( | ) |
Retrieve element description.
getErrorMessages | ( | ) |
Retrieve custom error messages.
getErrorMessageSeparator | ( | ) |
Get errorMessageSeparator.
getErrors | ( | ) |
Retrieve validator chain errors.
getFilter | ( | $name | ) |
getFilters | ( | ) |
Get all filters.
getFullyQualifiedName | ( | ) |
Get fully qualified name.
Places name as subitem of array and/or appends brackets.
getId | ( | ) |
Get element id.
getIgnore | ( | ) |
Get ignore flag (used when retrieving values at form level)
getLabel | ( | ) |
Retrieve element label.
getMessages | ( | ) |
getName | ( | ) |
Return element name.
getOrder | ( | ) |
Retrieve element order.
getPluginLoader | ( | $type | ) |
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.
string | $type |
Zend_Loader_Exception | on invalid type. |
getTranslator | ( | ) |
Retrieve localization translator object.
getType | ( | ) |
Return element type.
getUnfilteredValue | ( | ) |
Retrieve unfiltered element value.
getValidator | ( | $name | ) |
Retrieve a single validator by name.
string | $name |
getValidators | ( | ) |
Retrieve all validators.
getValue | ( | ) |
Retrieve filtered element value.
getView | ( | ) |
Retrieve view object.
Retrieves from ViewRenderer if none previously set.
hasErrors | ( | ) |
Are there errors registered?
hasTranslator | ( | ) |
Does this element have its own specific translator?
init | ( | ) |
Initialize object; used by extending classes.
isArray | ( | ) |
Is the element representing an array?
isRequired | ( | ) |
Is the element required?
isValid | ( | $value, | |
$context = null |
|||
) |
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.
mixed | $value | |
mixed | $context |
loadDefaultDecorators | ( | ) |
Load default decorators.
loadDefaultDecoratorsIsDisabled | ( | ) |
Should we load the default decorators?
markAsError | ( | ) |
Mark the element as being in a failed validation state.
removeDecorator | ( | $name | ) |
removeFilter | ( | $name | ) |
removeValidator | ( | $name | ) |
Remove a single validator by name.
string | $name |
render | ( | Zend_View_Interface | $view = null | ) |
|
static |
Used to resolve and return an element ID.
Passed to the HtmlTag decorator as a callback in order to provide an ID.
Zend_Form_Decorator_Interface | $decorator |
setAllowEmpty | ( | $flag | ) |
Set 'allow empty' flag.
When the allow empty flag is enabled and the required flag is false, the element will validate with empty values.
bool | $flag |
setAttrib | ( | $name, | |
$value | |||
) |
Set element attribute.
string | $name | |
mixed | $value |
Zend_Form_Exception | for invalid $name values |
setAttribs | ( | array | $attribs | ) |
setAutoInsertNotEmptyValidator | ( | $flag | ) |
Set flag indicating whether a NotEmpty validator should be inserted when element is required.
bool | $flag |
setBelongsTo | ( | $array | ) |
setConcatJustValuesInErrorMessage | ( | $concatJustValuesInErrorMessage | ) |
Use one error message for array elements with concatenated values.
boolean | $concatJustValuesInErrorMessage |
setConfig | ( | Zend_Config | $config | ) |
setDecorators | ( | array | $decorators | ) |
setDescription | ( | $description | ) |
setDisableLoadDefaultDecorators | ( | $flag | ) |
setDisableTranslator | ( | $flag | ) |
Indicate whether or not translation should be disabled.
bool | $flag |
setErrorMessages | ( | array | $messages | ) |
Same as addErrorMessages(), but clears custom error message stack first.
array | $messages |
setErrorMessageSeparator | ( | $separator | ) |
setErrors | ( | array | $messages | ) |
Overwrite any previously set error messages and flag as failed validation.
array | $messages |
setFilters | ( | array | $filters | ) |
Add filters to element, overwriting any already existing.
array | $filters |
setIgnore | ( | $flag | ) |
Set ignore flag (used when retrieving values at form level)
bool | $flag |
setIsArray | ( | $flag | ) |
setLabel | ( | $label | ) |
setName | ( | $name | ) |
setOptions | ( | array | $options | ) |
setOrder | ( | $order | ) |
setPluginLoader | ( | Zend_Loader_PluginLoader_Interface | $loader, |
$type | |||
) |
Set plugin loader to use for validator or filter chain.
Zend_Loader_PluginLoader_Interface | $loader | |
string | $type | 'decorator', 'filter', or 'validate' |
Zend_Form_Exception | on invalid type |
setRequired | ( | $flag = true | ) |
setTranslator | ( | $translator = null | ) |
Set translator object for localization.
Zend_Translate | null | $translator |
setValidators | ( | array | $validators | ) |
Set multiple validators, overwriting previous validators.
array | $validators |
setValue | ( | $value | ) |
setView | ( | Zend_View_Interface | $view = null | ) |
translatorIsDisabled | ( | ) |
Is translation disabled?
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
$helper = 'formText' |
const DECORATOR = 'DECORATOR' |
Element Constants.
const FILTER = 'FILTER' |
const VALIDATE = 'VALIDATE' |