Zend framework Zend 1.12更改FormElement中特定装饰符的值

Zend framework Zend 1.12更改FormElement中特定装饰符的值,zend-framework,zend-form,zend-decorators,Zend Framework,Zend Form,Zend Decorators,我正在用表格格式呈现一个非常简单的表单。我首先添加元素,然后使用以下内容设置它们的基本装饰器: $this->setElementDecorators(array( 'Viewhelper', array(array('data'=>'HtmlTag'),array('tag'=>'td')), 'Label', array(array('labelCell'=>'HtmlTag'),array('tag'=

我正在用表格格式呈现一个非常简单的表单。我首先添加元素,然后使用以下内容设置它们的基本装饰器:

$this->setElementDecorators(array(
        'Viewhelper',
        array(array('data'=>'HtmlTag'),array('tag'=>'td')),
        'Label',
        array(array('labelCell'=>'HtmlTag'),array('tag'=>'td', 'align'=>'right')),
        array(array('row'=>'HtmlTag'), array('tag'=>'tr'))
    ));
之后,我操纵任何一组元素(根据需要)来设置不同的外观,例如:将元素分组到一行中。要执行最后一项操作,请执行以下操作:

$this->getElement($elementName)->setDecorators(array(
        'Viewhelper',
        array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => $colspan)),
        'Label',
        array(array('labelCell' => 'HtmlTag'), array('tag' => 'td', 'align' => 'right')),
        array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
    ));
如您所见,我必须
setDecorators()


我的问题是:是否可以访问和更改单个decorator,而不必设置元素以前的所有decorator?

您应该能够调用:

$viewHelperDecorator = $this->getElement($elementName)->getDecorator('ViewHelper');
然后,这就像其他任何装饰器一样(它是装饰器抽象)-因此您可以调用

$viewHelperDecorator->setOption();
然后设定你想要的零钱