我写了以下setDecorators无线电元素,
$objUserGender = new Zend_Form_Element_Radio('userGender');
$objUserGender
->addFilter('StripTags')
->addFilter('StringTrim')
->setDecorators(array('ViewHelper'))
->addMultiOptions(array(
'Practice' => 'Practice',
'Qualifying' => 'Qualifying'))
->setValue('Male')
->removeDecorator('DtDdWrapper')
->setDecorators(array("ViewHelper",array('label', array('class'=>'label_radio'))))
->setSeparator(' ');
这会产生以下结果,
<label for="userGender-Practice">
<input type="radio" checked="checked" value="Practice" id="userGender-Practice" name="userGender">Practice
</label>
<label for="userGender-Qualifying"><input type="radio" value="Qualifying" id="userGender-Qualifying" name="userGender">Qualifying
</label>
但我想在label标签中添加class并想要输出
<label class="label_radio" for="radio-01">
<input name="sample-radio" id="radio-01" value="1" type="radio">
Male
</label>
<label class="label_radio" for="radio-02">
<input name="sample-radio" id="radio-02" value="2" type="radio">
Female
</label>
请帮助将类设置为Label
谢谢,