Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function loadDefaultDecorators()
- {
- parent::loadDefaultDecorators();
- $this->setDecorators( array( 'FormElements', 'form' ) );
- $this->setElementDecorators( array(
- 'Description',
- 'ViewHelper',
- 'Errors',
- array( array( 'row' => 'HtmlTag' ), array( 'tag' => 'div' ) )
- ) );
- $subForms = $this->getSubForms();
- foreach ( $subForms as $subForm )
- {
- $subForm->setDecorators( array(
- 'FormElements',
- array('HtmlTag', array('tag' => 'table', 'class' => 'standart')),
- 'Fieldset'
- ) );
- $subelements = $subForm->getElements();
- foreach ( $subelements as $subelement )
- {
- $subelement->setDecorators( array(
- 'ViewHelper',
- 'Errors',
- array( array( 'data' => 'HtmlTag' ), array( 'tag' => 'td', 'class' => 'element' ) ),
- array( 'Label', array( 'tag' => 'td' ) ),
- array( 'Description', array( 'tag' => 'td' ) ),
- array( array( 'row' => 'HtmlTag' ), array( 'tag' => 'tr' ) ),
- ) );
- }
- }
- $elements = $this->getElements();
- foreach ( $elements as $element )
- {
- // элементы-кнопки в label не нуждаются
- if ( 'Zend_Form_Element_Submit' == $element->getType() )
- {
- $element->setDecorators( array(
- 'ViewHelper',
- 'Description',
- 'Errors',
- array( array( 'row' => 'HtmlTag' ), array( 'tag' => 'div' ) )
- ) );
- }
- if ( 'Zend_Form_Element_Checkbox' == $element->getType() )
- {
- $element->setDecorators( array(
- 'ViewHelper',
- 'Description',
- 'Errors',
- array( 'Label', array( 'placement' => 'append' ) ),
- array( array( 'row' => 'HtmlTag' ), array( 'tag' => 'div' ) )
- ) );
- }
- //спрятанные элементы вообще не нуждаются в декораторах, помимо самого элемента
- if ( 'Zend_Form_Element_Hidden' == $element->getType() )
- {
- $element->setDecorators( array(
- 'ViewHelper',
- ) );
- }
- }
- return $this;
- }
Add Comment
Please, Sign In to add comment