Reputation: 839
This:
$promo_details = new Zend_Form_Element_Textarea('promo_details');
$promo_details->setLabel('Promo Details: ')
->setDecorators($element_decorators)
->addDecorator('Label', array('tag' => 'div'));
outputs:
<div id="promo_details-label">
<label for="promo_details" class="optional">Promo Details:</label>
</div>
but I want to output:
<div id="label_row"> <-- changed the div#
<label for="promo_details" class="optional">Promo Details:</label>
</div>
How do I tell Zend to not use the default ID it generates for "addDecorator('Label', array('tag' => 'div'))" but instead allow me to specify my own? I can't find any information pointing me in the right direction.
@Royal BG ----
If I do:
->addDecorator('Label', array('tag' => 'div', 'class' => 'label_row'))
I get:
<div id="promo_details-label">
<label for="promo_details" class="label_row optional">Promo Details:</label>
</div>
Where the class is added to the label instead of the div tag around the label, which is where I want it to go.
Upvotes: 0
Views: 89
Reputation: 6561
There is no way to set id for the label decorator's tag (see Zend_Form_Decorator_Label
render()
- the id is hardcoded there as label id + "-label"
).
To get html you want you can either:
Zend_Form_Decorator_Label
and provide sort of setTagId()
there - certainly an overkillZend_Form_Decorator_Label
without tag option, and wrap it with Zend_Form_Decorator_HtmlTag
(with id needed) manuallyUpvotes: 1