i currently set my default decorators for my Zend_Form using a class
extending from Zend_Form ... i didnt want to just use
$this->setElementDecorators() because i will use the same decorators for all
forms in the app
class Application_Form_Abstract extends Zend_Form {
...
function loadDefaultDecorators() {
if ($this->loadDefaultDecoratorsIsDisabled()) {
return $this;
}
// ... for elements
$decorators = $this->_elementDecorators;
if (empty($decorators)) {
$this->setElementDecorators(array(
'ViewHelper',
'Errors',
array('Description', array('tag' => 'p', 'escape' =>
false)),
'Label',
array('HtmlTag', array('tag' => 'p'))
));
but i soon realize that that way, i cannot define specific element
decorators like
$this->addElement('textarea', 'bio', array(
'decorators' => array(
'ViewHelper',
'Errors',
array('Description', array('tag' => 'p', 'escape' => false)),
'Label',
array('HtmlTag', array('tag' => 'p')),
new Application_Form_Decorator_WmdPreview,
)
));
as they will be over-written by my custom loadDefaultDecorators() function.
i wonder if there is any way i can set default decorators for element only
if they have no set decorators
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/What-is-the-right-way-of-setting-default-decorators-for-Zend-Form-elements-tp2312973p2312973.html
Sent from the Zend Framework mailing list archive at Nabble.com.