我写了以下 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_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>
请帮助将类设置为标签
谢谢,