【问题标题】:Zend_Form::setElementDecorators $elements param doesn't make a differenceZend_Form::setElementDecorators $elements 参数没有区别
【发布时间】:2010-12-19 07:06:26
【问题描述】:

来自文档...

Zend_Form setElementDecorators ( $decorators, [$elements = null], [bool $include = true])

array $decorators
array|null $elements: Specific elements to decorate or exclude from decoration
bool $include: Whether $elements is an inclusion or exclusion list

我想为我的大部分元素重复使用相同的装饰器......但不是提交按钮......我试过了

...

$this->addElement('submit', 'btnSubmitProject', array(
  'label' => 'Add Project',
  'ignore' => true
));

$this->setElementDecorators(
  array(
    'ViewHelper',
    'Errors',
    'Label'
  ),
  array(
    'btnSubmitProject', 'submit' // I think I should be using the 1st (btnSubmitProject) but I have 'submit' just to be sure
  ),
  true // and false
);

我为$include 标志尝试了真假。两者似乎都没有区别。所有元素的样式都相同,带有标签

【问题讨论】:

  • 您不需要在 $elements 数组中添加第二个元素。

标签: zend-framework zend-form zend-decorators


【解决方案1】:
$sumbit ->removeDecorator('label');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-14
    • 2013-05-24
    • 1970-01-01
    • 2020-05-25
    • 2017-04-19
    相关资源
    最近更新 更多