How would I format Zend_Form_Element_Radio so the label follows the input?

前端 未结 6 921
猫巷女王i
猫巷女王i 2021-01-05 20:41

The default decorator for the Zend_Form_Element_Radio is

6条回答
  •  星月不相逢
    2021-01-05 20:54

    This is the best thing you might can do, which I found it after a lot of pain :))

    $radios = new Zend_Form_Element_Radio('notifications');
    $notificationTypesArray = array();
    foreach ($notificationTypes as $key => $value) {
         $notificationTypesArray[$key] = $value
    $radios->removeDecorator('DtDdWrapper');
    $radios->removeDecorator('HtmlTag');
    $radios->setSeparator('');
    $radios->setDecorators(array(
        'ViewHelper',
        'Errors',
        array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'notification_type_row')),
        array('Label', array('tag' => 'span')),
        array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
    );
    $radios->addMultiOptions($notificationTypesArray);              
    $this->addElement($radios);
    

提交回复
热议问题