如何在Zend Framework 1.9中为标签标签添加ID?

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.

查看全部
duanmeng1862
duanmeng1862
2014/02/17 20:54
  • php
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复