To configure a decorator, pass an array of options or a
Zend_Config object to its constructor, an array to
setOptions(), or a
Zend_Config object to
Standard options include:
placement: Placement can be either 'append' or 'prepend' (case insensitive), and indicates whether content passed to
render()will be appended or prepended, respectively. In the case that a decorator replaces the content, this setting is ignored. The default setting is to append.
separator: The separator is used between the content passed to
render()and new content generated by the decorator, or between items rendered by the decorator (e.g. FormElements uses the separator between each item rendered). In the case that a decorator replaces the content, this setting may be ignored. The default value is
The decorator interface specifies methods for interacting with options. These include:
setOption($key, $value): set a single option.
getOption($key): retrieve a single option value.
getOptions(): retrieve all options.
removeOption($key): remove a single option.
clearOptions(): remove all options.
Decorators are meant to interact with the various
Zend_Form class types:
and all classes deriving from them. The method
setElement() allows you to set the object the
decorator is currently working with, and
is used to retrieve it.
render() method accepts a string,
$content. When the first decorator is called, this
string is typically empty, while on subsequent calls it will be
populated. Based on the type of decorator and the options passed in,
the decorator will either replace this string, prepend the string,
or append the string; an optional separator will be used in the
latter two situations.