views:

10

answers:

1

I found code that would change the standard dt and dd tags to table tags for a Zend_Form_Element. Here is the code I used:

       $element->setDecorators(array(
   'ViewHelper',
   'Errors',
   array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
   array('Label', array('tag' => 'td', 'class' => 'rightAlign')),
   array(array('row' => 'HtmlTag'), array('tag' => 'tr'))

)); But this puts the class name 'rightAlign' on the label tag instead of the td. I can't seem to wrap my head around these custom decorators so can anyone tell me how to get the class name 'rightAlign' on the td surrounding the label?

A: 

Just add one more decorator

$element->setDecorators(array(
    'ViewHelper',
    'Errors',
    array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
    'Label',
    array(array('labelWrap' => 'HtmlTag'), array('tag' => 'td', 'class' => 'rightAlign')),
    array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
));
Vika
Thank you, that helped a lot. I really need to figure out how these decorators work properly lol.
0x001a4