Class Zend_Form_Element

Description

Implements interfaces:

Zend_Form_Element

  • version: $Id: Element.php 19130 2009-11-20 19:28:00Z matthew $
  • copyright: Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

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


	
			
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
 void __construct (string|array|Zend_Config $spec, [ $options = null])
 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()])
 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 ()
 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 50)

Default view helper to use

  • access: public

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

'Allow empty' flag

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

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

  • access: protected
string $_belongsTo (line 68)

Array to which element belongs

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

Element decorators

  • access: protected
string $_description (line 80)

Element description

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

Should we disable loading the default decorators?

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

Custom error messages

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

Separator to use when concatenating aggregate error messages (for

elements having array values)

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

Validation errors

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

Element filters

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

Ignore flag (used when retrieving values at form level)

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

Does the element represent an array?

  • access: protected

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

Is the error marked as in an invalid state?

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

Has the element been manually marked as invalid?

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

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 141)

Element label

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

Plugin loaders for filter and validator chains

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

Formatted validation error messages

  • access: protected
string $_name (line 159)

Element name

  • access: protected
int $_order (line 165)

Order of element

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

Required flag

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

Is translation disabled?

  • access: protected
string $_type (line 188)

Element type

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

Array of un-initialized validators

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

Array of initialized validators

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

Element value

  • access: protected

Redefined in descendants as:
Zend_View_Interface $_view (line 211)
  • access: protected
Methods
Constructor __construct (line 235)

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, [ $options = null])

Redefined in descendants as:
addDecorator (line 1776)

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 1818)

Add many decorators at once

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

Add an error message and mark element as failed validation

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

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 1394)

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

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

Add multiple error messages and flag element as failed validation

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

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 1581)

Add filters to element

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

Redefined in descendants as:
addPrefixPath (line 1025)

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 1058)

Add many prefix paths at once

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

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 1139)

Add multiple validators

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

Redefined in descendants as:
autoInsertNotEmptyValidator (line 670)

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

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

Clear all decorators

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

Clear custom error messages stack

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

Clear all filters

  • access: public
Zend_Form_Element clearFilters ()

Redefined in descendants as:
clearValidators (line 1276)

Clear all validators

  • access: public
Zend_Form_Element clearValidators ()

Redefined in descendants as:
filterName (line 445)

Filter a name to only allow valid variable characters

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

Get 'allow empty' flag

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

Retrieve element attribute

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

Return all attributes

  • access: public
array getAttribs ()

Redefined in descendants as:
getBelongsTo (line 787)

Return array name to which element belongs

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

Retrieve a registered decorator

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

Retrieve all decorators

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

Retrieve element description

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

Retrieve custom error messages

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

Get errorMessageSeparator

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

Retrieve validator chain errors

  • access: public
array getErrors ()

Redefined in descendants as:
getFilter (line 1637)

Retrieve a single filter by name

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

Redefined in descendants as:
getFilters (line 1668)

Get all filters

  • access: public
array getFilters ()

Redefined in descendants as:
getFullyQualifiedName (line 489)

Get fully qualified name

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

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

Get element id

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

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

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

Retrieve element label

  • access: public
string getLabel ()

Redefined in descendants as:
getMessages (line 1540)

Retrieve error messages

  • access: public
array getMessages ()

Redefined in descendants as:
getName (line 477)

Return element name

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

Retrieve element order

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

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 401)

Retrieve localization translator object

  • access: public
Zend_Translate_Adapter|null getTranslator ()

Redefined in descendants as:
getType (line 797)

Return element type

  • access: public
string getType ()

Redefined in descendants as:
getUnfilteredValue (line 582)

Retrieve unfiltered element value

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

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 1231)

Retrieve all validators

  • access: public
array getValidators ()

Redefined in descendants as:
getValue (line 564)

Retrieve filtered element value

  • access: public
mixed getValue ()

Redefined in descendants as:
getView (line 1740)

Retrieve view object

Retrieves from ViewRenderer if none previously set.

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

Are there errors registered?

  • access: public
bool hasErrors ()

Redefined in descendants as:
init (line 272)

Initialize object; used by extending classes

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

Is the element representing an array?

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

Is the element required?

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

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 303)

Load default decorators

  • access: public
void loadDefaultDecorators ()

Redefined in descendants as:
loadDefaultDecoratorsIsDisabled (line 293)

Should we load the default decorators?

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

Mark the element as being in a failed validation state

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

Remove a single decorator

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

Remove a filter by name

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

Redefined in descendants as:
removeValidator (line 1251)

Remove a single validator by name

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

Redefined in descendants as:
render (line 1958)

Render form element

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

Redefined in descendants as:
setAllowEmpty (line 706)

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 814)

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 837)

Set multiple attributes at once

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

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 772)

Set array to which element belongs

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

Set object state from Zend_Config object

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

Overwrite all decorators

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

Set element description

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

Set flag to disable loading default decorators

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

Indicate whether or not translation should be disabled

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

Redefined in descendants as:
setErrorMessages (line 1408)

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

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

Set errorMessageSeparator

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

Overwrite any previously set error messages and flag as failed validation

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

Add filters to element, overwriting any already existing

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

Redefined in descendants as:
setIgnore (line 728)

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

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

Set flag indicating if element represents an array

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

Set element label

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

Set element name

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

Set object state from options array

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

Redefined in descendants as:
setOrder (line 615)

Set element order

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

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 637)

Set required flag

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

Set translator object for localization

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

Redefined in descendants as:
setValidators (line 1189)

Set multiple validators, overwriting previous validators

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

Redefined in descendants as:
setValue (line 539)

Set element value

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

Redefined in descendants as:
setView (line 1727)

Set view object

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

Redefined in descendants as:
translatorIsDisabled (line 431)

Is translation disabled?

  • access: public
bool translatorIsDisabled ()

Redefined in descendants as:
_filterValue (line 552)

Filter a value

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

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 2151)

Retrieve error messages and perform translation and value substitution

  • access: protected
array _getErrorMessages ()

Redefined in descendants as:
_hasErrorMessages (line 2180)

Are there custom error messages registered?

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

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 2000)

Lazy-load a filter

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

Lazy-load a validator

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

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 887)

Overloading: retrieve object property

Prevents access to properties beginning with '_'.

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

Overloading: set object property

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

String representation of form element

Proxies to render().

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

Element Constants

FILTER = 'FILTER' (line 43)
VALIDATE = 'VALIDATE' (line 44)

Documentation generated on Thu, 01 Apr 2010 13:03:51 -0400 by phpDocumentor 1.4.3