-- Amr Mostafa <[EMAIL PROTECTED]> wrote
(on Saturday, 08 March 2008, 01:03 PM +0200):
> Pardon my rush there, I need to stop assuming that everyone lives on the
> subversion trunk :)
> Ok so here we go: This is going to work with the current trunk only or with 
> the
> next 1.5 release candidate :)

And it's also committed to the 1.5 release branch. :-)


> On Sat, Mar 8, 2008 at 1:01 PM, Amr Mostafa <[EMAIL PROTECTED]> wrote:
> 
>     You could do that using the ViewScript decorator with the new content
>     wrapping feature Matthew added few hours ago! :)
> 
>     Here is your new setElementDecorators():
> 
>             $form->setElementDecorators(array(
>                 array('ViewHelper'),
>                 array('ViewScript', array('viewScript' => 'element.phtml',
>     'placement' => false)),
>             ));
> 
>     Then in your element.phtml:
> 
>     <?php
>     require_once 'Zend/Form/Decorator/Label.php';
>     $label = new Zend_Form_Decorator_Label();
>     $label->setElement($this->element);
>     ?>
>     <tr>
>         <td>
>             <?= $label->render('') ?>
>         </td>
>         <td>
>             <?= $this->content ?>
>         </td>
>     </tr>
> 
>     One small note about the Label decorator, we could actually write the
>     <label> tag ourselves like: <label for="<?= 
> $this->element->getAttrib('id')
>     ?>"><?= $this->element->getLabel() ?></label>
>     But that's not good enough, what if the element doesn't have 'id' set?
>     Label decorator is smart to fall back to the element name if id is not 
> set,
>     and it has a bunch of other extras, like adding the optional/required
>     classes, ...etc.
> 
>     Best Regards,
>     - Amr
> 
> 
>     On Sat, Mar 8, 2008 at 4:55 AM, Karl Katzke <[EMAIL PROTECTED]> wrote:
> 
>         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?
> 
>         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.
> 
>         Thanks,
>         Karl Katzke
> 
> 
> 
> 

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to