How can i set default element & form decorators for all my Zend_Forms
how can i go abt setting up default decorators for all my forms & form elements? currently in individual forms i do something like
// in init()
...
$this->setElementDecorators(array(
'ViewHelper',
'Errors',
array('Description', array('tag' => 'p')),
'Label',
array('HtmlTag', array('tag' => 'p'))
));
$this->getElement('btnLogin')->removeDecorator('Label');
$this->setDecorators(array(
'FormElements',
array('Errors', arr开发者_高级运维ay('placement' => 'PREPEND')),
'Form'
));
one part i see maybe harder is i want my submit buttons not to have a label.
For forms you can override Zend_Form class with your own and redefine loadDefaultDecorators method there. Then just inherit your forms from your form class. Zend_Form_Element also has loadDefaultDecorators method.
精彩评论