2009-12-07 11:28
采纳率: 0%
浏览 41


I am having trouble over ridding the default set of decorators with Zend_Form.

I am attempting to extend Zend_Form in order to implement a different decorator style.

class CRM_Form extends Zend_Form
 public function init()


   new Zend_Form_Decorator_HtmlTag(array('tag' => 'p'))

When I attempt to make use of this class like so:

$form = new CRM_Form();
$id = $form->createElement('text','id')->setLabel('ID:');

The old decorators are used (definition list) rather than my paragraph style.

If I addElement()'s in the init() method of the CRM_Form class they use the style that I have set.

How can I force all elements created using that class to use my default style?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dougan4884 2009-12-07 13:22

    Zend Form is decorating the Elements after you add them. So create an method like "addAndDecorte":

    public function addAndDecorate($element) 
       // do your decorating stuff..
    解决 无用
    打赏 举报
  • 查看更多回答(2条)

相关推荐 更多相似问题