
Zend Framework 1.12 - Form Decorator settings
I really like the dl/dt/dd output of Zend Framework for forms, but there came a day when I needed a lot more control over the presentation.
In order to remove the dl/dt/dd I used these settings in the form.
In form/model/edit.php
PHP
$this->setDecorators(array( | |
array('ViewScript', array('viewScript' => '/model/form/edit.phtml')))); | |
$this->setElementDecorators(array( | |
'ViewHelper', | |
'Errors', | |
'Label', | |
array('HtmlTag', array('tag' => 'div')), | |
'Description')); |
In /model/form/edit.phtml
PHP
<?php echo $this->element->contact_first_name ?> |
Resulting HTML
XML
<div><label for="name" class="required">Name</label> | |
<input type="text" name="name" id="name" value="" autocomplete="off"></div> |
References
http://framework.zend.com/manual/1.12/en/zend.form.standardDecorators.html
http://devzone.zend.com/1240/decorators-with-zend_form/
Print article | This entry was posted by elvis on 06/25/13 at 09:08:00 am . Follow any responses to this post through RSS 2.0. |