I'm trying to generate this html hierarchy in my zend_form display group:
<div class="settings">
<div class="dashed-outline"> //want to add this div
<fieldset disabledefaultdecorators="1" id="fieldset-settings">
<legend>Cards</legend>
</fieldset>
</div>
</div>
This is what I have currently:
<div class="settings">
<fieldset disabledefaultdecorators="1" id="fieldset-settings">
<legend>Cards</legend>
</fieldset>
</div>
And this is the code for the above:
$form->addDisplayGroup($flashcardGroup,
'settings',
array(
'legend' => 'Cards',
'disableDefaultDecorators' => true,
'decorators' => array(
'FormElements',
'Fieldset',
array('HtmlTag',array('tag' => 'div', 'class' => 'settings')),
)
)
);
How do I add the extra div in here?
If you want to use the same decorator twice in Zend_Form, you can pass array(array('alias'=>'Decorator'), $options)
using the setDecorators
array syntax. Also, you shouldn't need to use disableDefaultDecorators
if you are passing a decorators
option
$form->addDisplayGroup($flashcardGroup,
'settings',
array(
'legend' => 'Cards',
'decorators' => array(
'FormElements',
'Fieldset',
// need to alias the HtmlTag decorator so you can use it twice
array(array('Dashed'=>'HtmlTag'), array('tag'=>'div', 'class'=>'dashed-outline')),
array('HtmlTag',array('tag' => 'div', 'class' => 'settings')),
)
)
);