Используйте промежуточный класс для широкой конфигурации вашего проекта.Затем вы расширите этот класс вместо Zend_Form
file My/Form.php
<?php
abstract class My_Form extends Zend_Form {
public function __construct ( $options = null ) {
parent::__construct($options);
$this->setElementDecorators(array(
// the base <input, <select, <textarea markup
'ViewHelper',
// wrap that into a <div class="input-wrap" />
array (
'HtmlTag',
array (
'tag' => 'div',
'class' => 'input-wrap',
)
),
// append errors in <ul/li>
'Errors',
// then prepend <label markup
'Label',
));
}
}
, затем в файле My/Form/Demo.php
<?php
class My_Form_Demo extends My_Form {
public function init () {
// Your elements here
}
}
Вы можете сделать это дляа также конкретный элемент
file My/Form/Element/Group.php
<?php
class My_Form_Element_Group extends Zend_Form_Element_Select {
public function init () {
// Specific options
$this->addMultiOptions(array(
'A' => 'group A',
'B' => 'group B',
));
// This element doesn't need the div.input-wrap
$this->removeDecorator('HtmlTag');
}
}