Zend_Form ::如何从zend表单中删除所有标签?$ title-> removeDecorator('Label'); 一个但是所有元素?

Yos*_*sef 0 zend-framework zend-form

Zend_Form ::如何从zend表单中删除所有标签?$title->removeDecorator('Label');一个但是所有元素?

谢谢

Mik*_*ike 6

这可以在紧要关头工作.

class My_Form extends Zend_Form
{
    public function init(){
        foreach($this->getElements() as $element)
        {
            $element->removeDecorator('Label');
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

如果你想为所有元素设置装饰器这样的东西应该工作:

class My_Form extends Zend_Form
{
    public function init(){
        $this->setElementDecorators(array(
        'ViewHelper',
        array('HtmlTag', array('tag' => 'div'));
    }
}
Run Code Online (Sandbox Code Playgroud)