Class Zend_Form_Element

Description

Implements interfaces:

Zend_Form_Element

  • version: $Id: Element.php 22465 2010-06-19 17:41:03Z alab $
  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Form/Element.php (line 43)


	
			
Direct descendents
Class Description
Abstract class Zend_Dojo_Form_Element_Dijit Base element for dijit elements
Abstract class Zend_Form_Element_Xhtml Base element for XHTML elements
Class Constant Summary
 DECORATOR = 'DECORATOR'
 FILTER = 'FILTER'
 VALIDATE = 'VALIDATE'
Variable Summary
Method Summary
 Zend_Form_Element addDecorator (string|Zend_Form_Decorator_Interface $decorator, [array|Zend_Config $options = null])
 Zend_Form_Element addError (string $message)
 Zend_Form_Element addErrorMessage (string $message)
 Zend_Form_Element addFilter (string|Zend_Filter_Interface $filter, [ $options = array()])
 Zend_Form_Element addPrefixPath (string $prefix, string $path, [string $type = null])
 Zend_Form_Element addValidator (string|Zend_Validate_Interface $validator, [bool $breakChainOnFailure = false], [array $options = array()])
 void __construct (string|array|Zend_Config $spec, [array|Zend_Config $options = null])
 string filterName (string $value, [bool $allowBrackets = false])
 bool getAllowEmpty ()
 string getAttrib (string $name)
 array getAttribs ()
 string getBelongsTo ()
 array getDecorators ()
 string getDescription ()
 array getErrorMessages ()
 array getErrors ()
 array getFilters ()
 string getId ()
 bool getIgnore ()
 string getLabel ()
 array getMessages ()
 string getName ()
 int getOrder ()
 string getType ()
 Zend_Validate_Interface|false getValidator (string $name)
 array getValidators ()
 mixed getValue ()
 bool hasErrors ()
 bool hasTranslator ()
 void init ()
 bool isArray ()
 bool isRequired ()
 boolean isValid (mixed $value, [mixed $context = null])
 bool removeValidator (string $name)
 string render ([ $view = null])
 Zend_Form_Element setAttrib (string $name, mixed $value)
 Zend_Form_Element setBelongsTo (string $array)
 Zend_Form_Element setDescription (string $description)
 Zend_Form_Element setLabel (string $label)
 Zend_Form_Element setName (string $name)
 Zend_Form_Element setOrder (int $order)
 Zend_Form_Element setPluginLoader ( $loader, string $type)
 Zend_Form_Element setRequired ([bool $flag = true])
 Zend_Form_Element setTranslator ([Zend_Translate|null $translator = null])
 Zend_Form_Element setValue (mixed $value)
 Zend_Form_Element setView ([ $view = null])
 void _filterValue ( &$value,  &$key, string $value, string $key)
 Zend_Form_Decorator_Interface _getDecorator (string $name, null|array $options)
 Zend_Form_Decorator_Interface _loadDecorator ( $decorator, mixed $name)
 string __call (string $method, array $args)
 mixed __get (string $key)
 voide __set (string $key, mixed $value)
 string __toString ()
Variables
string $helper = 'formText' (line 56)

Default view helper to use

  • access: public

Redefined in descendants as:
bool $_allowEmpty = true (line 62)

'Allow empty' flag

  • access: protected
bool $_autoInsertNotEmptyValidator = true (line 68)

Flag indicating whether or not to insert NotEmpty validator when element is required

  • access: protected
string $_belongsTo (line 74)

Array to which element belongs

  • access: protected
array $_decorators = array() (line 80)

Element decorators

  • access: protected
string $_description (line 86)

Element description

  • access: protected
bool $_disableLoadDefaultDecorators = false (line 92)

Should we disable loading the default decorators?

  • access: protected
array $_errorMessages = array() (line 98)

Custom error messages

  • access: protected
string $_errorMessageSeparator = '; ' (line 111)

Separator to use when concatenating aggregate error messages (for

elements having array values)

  • access: protected
array $_errors = array() (line 104)

Validation errors

  • access: protected
array $_filters = array() (line 117)

Element filters

  • access: protected
bool $_ignore = false (line 123)

Ignore flag (used when retrieving values at form level)

  • access: protected
bool $_isArray = false (line 129)

Does the element represent an array?

  • access: protected

Redefined in descendants as:
bool $_isError = false (line 135)

Is the error marked as in an invalid state?

  • access: protected
bool $_isErrorForced = false (line 141)

Has the element been manually marked as invalid?

  • access: protected
bool $_isPartialRendering = false (line 227)

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.

  • access: protected
string $_label (line 147)

Element label

  • access: protected
array $_loaders = array() (line 153)

Plugin loaders for filter and validator chains

  • access: protected
array $_messages = array() (line 159)

Formatted validation error messages

  • access: protected
string $_name (line 165)

Element name

  • access: protected
int $_order (line 171)

Order of element

  • access: protected
bool $_required = false (line 177)

Required flag

  • access: protected
Zend_Translate $_translator (line 182)
  • access: protected
bool $_translatorDisabled = false (line 188)

Is translation disabled?

  • access: protected
string $_type (line 194)

Element type

  • access: protected
array $_validatorRules = array() (line 206)

Array of un-initialized validators

  • access: protected
array $_validators = array() (line 200)

Array of initialized validators

  • var: Validators
  • access: protected
mixed $_value (line 212)

Element value

  • access: protected

Redefined in descendants as:
Zend_View_Interface $_view (line 217)
  • access: protected
Methods
addDecorator (line 1822)

Add a decorator for rendering the element

  • access: public
Zend_Form_Element addDecorator (string|Zend_Form_Decorator_Interface $decorator, [array|Zend_Config $options = null])
addDecorators (line 1864)

Add many decorators at once

  • access: public
Zend_Form_Element addDecorators ( $decorators)
  • array $decorators
addError (line 1528)

Add an error message and mark element as failed validation

  • access: public
Zend_Form_Element addError (string $message)
  • string $message
addErrorMessage (line 1428)

Add a custom error message to return in the event of failed validation

  • access: public
Zend_Form_Element addErrorMessage (string $message)
  • string $message
addErrorMessages (line 1440)

Add multiple custom error messages to return in the event of failed validation

  • access: public
Zend_Form_Element addErrorMessages ( $messages)
  • array $messages
addErrors (line 1541)

Add multiple error messages and flag element as failed validation

  • access: public
Zend_Form_Element addErrors ( $messages)
  • array $messages
addFilter (line 1600)

Add a filter to the element

  • access: public
Zend_Form_Element addFilter (string|Zend_Filter_Interface $filter, [ $options = array()])

Redefined in descendants as:
addFilters (line 1627)

Add filters to element

  • access: public
Zend_Form_Element addFilters ( $filters)
  • array $filters

Redefined in descendants as:
addPrefixPath (line 1047)

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.

  • throws: Zend_Form_Exception for invalid type
  • access: public
Zend_Form_Element addPrefixPath (string $prefix, string $path, [string $type = null])
  • string $prefix
  • string $path
  • string $type

Redefined in descendants as:
addPrefixPaths (line 1080)

Add many prefix paths at once

  • access: public
Zend_Form_Element addPrefixPaths ( $spec)
  • array $spec
addValidator (line 1129)

Add validator to validation chain

Note: will overwrite existing validators if they are of the same class.

  • throws: Zend_Form_Exception if invalid validator type
  • access: public
Zend_Form_Element addValidator (string|Zend_Validate_Interface $validator, [bool $breakChainOnFailure = false], [array $options = array()])

Redefined in descendants as:
addValidators (line 1161)

Add multiple validators

  • access: public
Zend_Form_Element addValidators ( $validators)
  • array $validators

Redefined in descendants as:
autoInsertNotEmptyValidator (line 692)

Get flag indicating whether a NotEmpty validator should be inserted when element is required

  • access: public
bool autoInsertNotEmptyValidator ()
clearDecorators (line 1995)

Clear all decorators

  • access: public
Zend_Form_Element clearDecorators ()
clearErrorMessages (line 1475)

Clear custom error messages stack

  • access: public
Zend_Form_Element clearErrorMessages ()
clearFilters (line 1759)

Clear all filters

  • access: public
Zend_Form_Element clearFilters ()

Redefined in descendants as:
clearValidators (line 1298)

Clear all validators

  • access: public
Zend_Form_Element clearValidators ()

Redefined in descendants as:
Constructor __construct (line 242)

Constructor

$spec may be:

  • string: name of element
  • array: options with which to configure element
  • Zend_Config: Zend_Config with options for configuring element

  • throws: Zend_Form_Exception if no element name after initialization
  • access: public
void __construct (string|array|Zend_Config $spec, [array|Zend_Config $options = null])

Redefined in descendants as:
filterName (line 462)

Filter a name to only allow valid variable characters

  • access: public
string filterName (string $value, [bool $allowBrackets = false])
  • string $value
  • bool $allowBrackets
getAllowEmpty (line 739)

Get 'allow empty' flag

  • access: public
bool getAllowEmpty ()
getAttrib (line 874)

Retrieve element attribute

  • access: public
string getAttrib (string $name)
  • string $name
getAttribs (line 889)

Return all attributes

  • access: public
array getAttribs ()

Redefined in descendants as:
getBelongsTo (line 809)

Return array name to which element belongs

  • access: public
string getBelongsTo ()
getDecorator (line 1923)

Retrieve a registered decorator

  • access: public
false|Zend_Form_Decorator_Abstract getDecorator (string $name)
  • string $name
getDecorators (line 1954)

Retrieve all decorators

  • access: public
array getDecorators ()
getDescription (line 714)

Retrieve element description

  • access: public
string getDescription ()
getErrorMessages (line 1465)

Retrieve custom error messages

  • access: public
array getErrorMessages ()
getErrorMessageSeparator (line 1486)

Get errorMessageSeparator

  • access: public
string getErrorMessageSeparator ()
getErrors (line 1576)

Retrieve validator chain errors

  • access: public
array getErrors ()

Redefined in descendants as:
getFilter (line 1683)

Retrieve a single filter by name

  • access: public
Zend_Filter_Interface getFilter (string $name)
  • string $name

Redefined in descendants as:
getFilters (line 1714)

Get all filters

  • access: public
array getFilters ()

Redefined in descendants as:
getFullyQualifiedName (line 506)

Get fully qualified name

Places name as subitem of array and/or appends brackets.

  • access: public
string getFullyQualifiedName ()
getId (line 526)

Get element id

  • access: public
string getId ()
getIgnore (line 761)

Get ignore flag (used when retrieving values at form level)

  • access: public
bool getIgnore ()
getLabel (line 621)

Retrieve element label

  • access: public
string getLabel ()

Redefined in descendants as:
getMessages (line 1586)

Retrieve error messages

  • access: public
array getMessages ()

Redefined in descendants as:
getName (line 494)

Return element name

  • access: public
string getName ()
getOrder (line 648)

Retrieve element order

  • access: public
int getOrder ()
getPluginLoader (line 1004)

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.

  • throws: Zend_Loader_Exception on invalid type.
  • access: public
Zend_Loader_PluginLoader getPluginLoader (string $type)
  • string $type

Redefined in descendants as:
getTranslator (line 409)

Retrieve localization translator object

  • access: public
Zend_Translate_Adapter|null getTranslator ()

Redefined in descendants as:
getType (line 819)

Return element type

  • access: public
string getType ()

Redefined in descendants as:
getUnfilteredValue (line 599)

Retrieve unfiltered element value

  • access: public
mixed getUnfilteredValue ()
getValidator (line 1223)

Retrieve a single validator by name

  • return: False if not found, validator otherwise
  • access: public
Zend_Validate_Interface|false getValidator (string $name)
  • string $name

Redefined in descendants as:
getValidators (line 1253)

Retrieve all validators

  • access: public
array getValidators ()

Redefined in descendants as:
getValue (line 581)

Retrieve filtered element value

  • access: public
mixed getValue ()

Redefined in descendants as:
getView (line 1786)

Retrieve view object

Retrieves from ViewRenderer if none previously set.

  • access: public
null|Zend_View_Interface getView ()
hasErrors (line 1566)

Are there errors registered?

  • access: public
bool hasErrors ()

Redefined in descendants as:
hasTranslator (line 426)

Does this element have its own specific translator?

  • access: public
bool hasTranslator ()
init (line 279)

Initialize object; used by extending classes

  • access: public
void init ()
isArray (line 783)

Is the element representing an array?

  • access: public
bool isArray ()
isRequired (line 670)

Is the element required?

  • access: public
bool isRequired ()
isValid (line 1318)

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.

  • access: public
boolean isValid (mixed $value, [mixed $context = null])
  • mixed $value
  • mixed $context

Redefined in descendants as:
loadDefaultDecorators (line 310)

Load default decorators

  • access: public
Zend_Form_Element loadDefaultDecorators ()

Redefined in descendants as:
loadDefaultDecoratorsIsDisabled (line 300)

Should we load the default decorators?

  • access: public
bool loadDefaultDecoratorsIsDisabled ()
markAsError (line 1508)

Mark the element as being in a failed validation state

  • access: public
Zend_Form_Element markAsError ()
removeDecorator (line 1970)

Remove a single decorator

  • access: public
Zend_Form_Element removeDecorator (string $name)
  • string $name
removeFilter (line 1734)

Remove a filter by name

  • access: public
Zend_Form_Element removeFilter (string $name)
  • string $name

Redefined in descendants as:
removeValidator (line 1273)

Remove a single validator by name

  • access: public
bool removeValidator (string $name)
  • string $name

Redefined in descendants as:
render (line 2007)

Render form element

  • access: public
string render ([ $view = null])

Redefined in descendants as:
setAllowEmpty (line 728)

Set 'allow empty' flag

When the allow empty flag is enabled and the required flag is false, the element will validate with empty values.

  • access: public
Zend_Form_Element setAllowEmpty (bool $flag)
  • bool $flag
setAttrib (line 836)

Set element attribute

  • throws: Zend_Form_Exception for invalid $name values
  • access: public
Zend_Form_Element setAttrib (string $name, mixed $value)
  • string $name
  • mixed $value
setAttribs (line 859)

Set multiple attributes at once

  • access: public
Zend_Form_Element setAttribs ( $attribs)
  • array $attribs
setAutoInsertNotEmptyValidator (line 681)

Set flag indicating whether a NotEmpty validator should be inserted when element is required

  • access: public
Zend_Form_Element setAutoInsertNotEmptyValidator (bool $flag)
  • bool $flag
setBelongsTo (line 794)

Set array to which element belongs

  • access: public
Zend_Form_Element setBelongsTo (string $array)
  • string $array
setConfig (line 375)

Set object state from Zend_Config object

  • access: public
Zend_Form_Element setConfig ( $config)
setDecorators (line 1911)

Overwrite all decorators

  • access: public
Zend_Form_Element setDecorators ( $decorators)
  • array $decorators
setDescription (line 703)

Set element description

  • access: public
Zend_Form_Element setDescription (string $description)
  • string $description
setDisableLoadDefaultDecorators (line 289)

Set flag to disable loading default decorators

  • access: public
Zend_Form_Element setDisableLoadDefaultDecorators (bool $flag)
  • bool $flag
setDisableTranslator (line 437)

Indicate whether or not translation should be disabled

  • access: public
Zend_Form_Element setDisableTranslator (bool $flag)
  • bool $flag

Redefined in descendants as:
setErrorMessages (line 1454)

Same as addErrorMessages(), but clears custom error message stack first

  • access: public
Zend_Form_Element setErrorMessages ( $messages)
  • array $messages
setErrorMessageSeparator (line 1497)

Set errorMessageSeparator

  • access: public
Zend_Form_Element setErrorMessageSeparator (string $separator)
  • string $separator
setErrors (line 1555)

Overwrite any previously set error messages and flag as failed validation

  • access: public
Zend_Form_Element setErrors ( $messages)
  • array $messages
setFilters (line 1671)

Add filters to element, overwriting any already existing

  • access: public
Zend_Form_Element setFilters ( $filters)
  • array $filters

Redefined in descendants as:
setIgnore (line 750)

Set ignore flag (used when retrieving values at form level)

  • access: public
Zend_Form_Element setIgnore (bool $flag)
  • bool $flag
setIsArray (line 772)

Set flag indicating if element represents an array

  • access: public
Zend_Form_Element setIsArray (bool $flag)
  • bool $flag
setLabel (line 610)

Set element label

  • access: public
Zend_Form_Element setLabel (string $label)
  • string $label
setName (line 477)

Set element name

  • access: public
Zend_Form_Element setName (string $name)
  • string $name
setOptions (line 334)

Set object state from options array

  • access: public
Zend_Form_Element setOptions ( $options)
  • array $options

Redefined in descendants as:
setOrder (line 637)

Set element order

  • access: public
Zend_Form_Element setOrder (int $order)
  • int $order
setPluginLoader (line 979)

Set plugin loader to use for validator or filter chain

  • throws: Zend_Form_Exception on invalid type
  • access: public
Zend_Form_Element setPluginLoader ( $loader, string $type)

Redefined in descendants as:
setRequired (line 659)

Set required flag

  • access: public
Zend_Form_Element setRequired ([bool $flag = true])
  • bool $flag: Default value is true
setTranslator (line 389)

Set translator object for localization

  • access: public
Zend_Form_Element setTranslator ([Zend_Translate|null $translator = null])

Redefined in descendants as:
setValidators (line 1211)

Set multiple validators, overwriting previous validators

  • access: public
Zend_Form_Element setValidators ( $validators)
  • array $validators

Redefined in descendants as:
setValue (line 556)

Set element value

  • access: public
Zend_Form_Element setValue (mixed $value)
  • mixed $value

Redefined in descendants as:
setView (line 1773)

Set view object

  • access: public
Zend_Form_Element setView ([ $view = null])

Redefined in descendants as:
translatorIsDisabled (line 448)

Is translation disabled?

  • access: public
bool translatorIsDisabled ()

Redefined in descendants as:
_filterValue (line 569)

Filter a value

  • access: protected
void _filterValue ( &$value,  &$key, string $value, string $key)
  • string $value
  • string $key
  • &$value
  • &$key
_getDecorator (line 1803)

Instantiate a decorator based on class name or class name fragment

  • access: protected
Zend_Form_Decorator_Interface _getDecorator (string $name, null|array $options)
  • string $name
  • null|array $options
_getErrorMessages (line 2214)

Retrieve error messages and perform translation and value substitution

  • access: protected
array _getErrorMessages ()

Redefined in descendants as:
_hasErrorMessages (line 2243)

Are there custom error messages registered?

  • access: protected
bool _hasErrorMessages ()
_loadDecorator (line 2178)

Lazy-load a decorator

  • access: protected
Zend_Form_Decorator_Interface _loadDecorator ( $decorator, mixed $name)
  • array $decorator: Decorator type and options
  • mixed $name: Decorator name or alias
_loadFilter (line 2049)

Lazy-load a filter

  • access: protected
Zend_Filter_Interface _loadFilter ( $filter)
  • array $filter
_loadValidator (line 2098)

Lazy-load a validator

  • access: protected
Zend_Validate_Interface _loadValidator ( $validator)
  • array $validator: Validator definition
__call (line 945)

Overloading: allow rendering specific decorators

Call renderDecoratorName() to render a specific decorator.

  • throws: Zend_Form_Exception for invalid decorator or invalid method call
  • access: public
string __call (string $method, array $args)
  • string $method
  • array $args
__get (line 909)

Overloading: retrieve object property

Prevents access to properties beginning with '_'.

  • access: public
mixed __get (string $key)
  • string $key
__set (line 930)

Overloading: set object property

  • access: public
voide __set (string $key, mixed $value)
  • string $key
  • mixed $value
__toString (line 2032)

String representation of form element

Proxies to render().

  • access: public
string __toString ()
Class Constants
DECORATOR = 'DECORATOR' (line 48)

Element Constants

FILTER = 'FILTER' (line 49)
VALIDATE = 'VALIDATE' (line 50)

Documentation generated on Mon, 21 Jun 2010 15:18:42 -0400 by phpDocumentor 1.4.3