开发者

How can i set default element & form decorators for all my Zend_Forms

开发者 https://www.devze.com 2023-01-08 23:48 出处:网络
how can i go abt setting up default decorators for all my forms & form elements? currently in individual forms i do something like

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号