-- Bradley Holt <[EMAIL PROTECTED]> wrote
(on Friday, 05 December 2008, 07:09 PM -0500):
> I have a SubForm that and I'd like to set the content of its related dt. This
> is the first part of what I'm currently getting:
> 
> <dt>&nbsp;</dt><dd><fieldset id="fieldset-phone"><dl>...
> 
> What I want to do is replace the "&nbsp;" above with the word "Phones". It
> appears that there is no setLabel on SubForms like there is on form elements.
> There is a setLegend but that does not affect the dt, it only adds a legend
> element:
> 
> <dt>&nbsp;</dt><dd><fieldset id="fieldset-phone"><legend>Phones</legend>
> <dl>...
> 
> My guess is that I need to get a reference to the DtDdWrapper decorator and 
> set
> an option on that. However, I'm not sure what option(s) I'd use:
> 
>         $phoneSubForm->getDecorator('DtDdWrapper')->setOption('?', 'Phones');
> 
> Is this possible and if so am I going about it all wrong?

The DtDdWrapper actually doesn't have an option for that. You have two
options here.

Short term, create your own drop-in substitute for DtDdWrapper, and push
in this functionality. This is pretty trivial to achieve -- something
like this:

    class My_Form_Decorator_DtDdWrapper extends Zend_Form_Decorator_DtDdWrapper
    {
        public function render($content)
        {
            $dt = $this->getOption('dt');
            if (null === $dt) {
                $dt = '&nbsp;';
            }
            return '<dt>' . $dt . '</dt><dd>' . $content . '</dd>';
        }
    }

Long term, put an issue in the issue tracker to add support for
providing the dt content.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to