Zend_Form makes use of
Zend_Loader_PluginLoader to allow developers to specify
the locations of alternate elements and decorators. Each has its own
plugin loader associated with it, and general accessors are used to
retrieve and modify each.
The following loader types are used with the various plugin loader methods: 'element' and 'decorator'. The type names are case insensitive.
The methods used to interact with plugin loaders are as follows:
setPluginLoader($loader, $type): $loader is the plugin loader object itself, while type is one of the types specified above. This sets the plugin loader for the given type to the newly specified loader object.getPluginLoader($type): retrieves the plugin loader associated with $type.addPrefixPath($prefix, $path, $type = null): adds a prefix/path association to the loader specified by $type. If $type isNULL, it will attempt to add the path to all loaders, by appending the prefix with each of "_Element" and "_Decorator"; and appending the path with "Element/" and "Decorator/". If you have all your extra form element classes under a common hierarchy, this is a convenience method for setting the base prefix for them.addPrefixPaths(array $spec): allows you to add many paths at once to one or more plugin loaders. It expects each array item to be an array with the keys 'path', 'prefix', and 'type'.
Additionally, you can specify prefix paths for all elements and
display groups created through a Zend_Form instance
using the following methods:
addElementPrefixPath($prefix, $path, $type = null): Just likeaddPrefixPath(), you must specify a class prefix and a path.$type, when specified, must be one of the plugin loader types specified byZend_Form_Element; see the element plugins section for more information on valid$typevalues. If no$typeis specified, the method will assume it is a general prefix for all types.addDisplayGroupPrefixPath($prefix, $path): Just likeaddPrefixPath(), you must specify a class prefix and a path; however, since display groups only support decorators as plugins, no$typeis necessary.
Custom elements and decorators are an easy way to share functionality between forms and encapsulate custom functionality. See the Custom Label example in the elements documentation for an example of how custom elements can be used as replacements for standard classes.




