-- Karl Katzke <[EMAIL PROTECTED]> wrote (on Friday, 07 March 2008, 08:55 PM -0600): > I'm using Zend_Form to build a form, and I'd like to align all of the labels > to > the right inside their table cells. I can do this with either CSS or the > align= > "right" attribute of the table cell, but I would need to be able to set > attributes on the tag... which by my read, currently isn't possible. > > Sample decorator: > > 46 $this->setElementDecorators(array( > 47 'ViewHelper', > 48 'Errors', > 49 array('decorator'=>array('td'=> > 'HtmlTag'),'options'=>array('tag'=>'td')), > 50 array('Label',array('tag'=>'td')), > 51 array('decorator'=>array('tr'=> > 'HtmlTag'),'options'=>array('tag'=>'tr')), > 52 )); > > In Zend_Form_Decorator_Label, we're already using Zend_Form_Decorator_HtmlTag > to render the tag option of the label. Could we add a tagoptions field to that > Label decorator and pass the array of options through to the > Zend_Form_Decorator_HtmlTag?
You can file an issue if you'd like to see this feature. In the meantime, extend the Label decorator to do what you'd like. :-) > I'm a bit of a newb to Zend Framework, and this is deep enough inside > the framework to make my head spin a bit, but it looks like a fairly > simple addition. I'm just not sure how to execute it without breaking > things further! I realize that everyone's in a rush to get the last > few changes in before the freeze, but I'd appreciate a hand with this > if anyone has the time. Code freeze is in around 100 minutes -- not going to make it in tonight. There is documentation in the manual -- particularly if you're willing to read the docbook XML currently in subversion (docbook is basically human readable, so don't let it stop you) -- that shows how to create plugins for the form classes, as well as how to substitute your own classes for standard plugins. Extend the Label decorator with your own Label decorator to do what you want. -- Matthew Weier O'Phinney PHP Developer | [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/