« Return to Thread: Multiple Form Element Decorators in Zend_Config

Re: Multiple Form Element Decorators in Zend_Config

by weierophinney :: Rate this Message:

Reply to Author | View in Thread

-- dvhas <dvhas@...> wrote
(on Monday, 07 April 2008, 12:07 PM -0700):

>
>
> I have the following in my ini configuration file.
>
> elementdecorators.decorator = "ViewHelper"
> elementdecorators.datatag.decorator = "HtmlTag"
> elementdecorators.datatag.options.tag = "<td>"
> elementdecorators.label.decorator = "Label"
> elementdecorators.label.options.tag = "<th>"
> elementdecorators.rowtag.decorator = "HtmlTag"
> elementdecorators.rowtag.options.tag = "<tr>"

First off, don't surround your tagname with brackets; those will be
escaped incorrectly if you do.

> When I apply it to my form, it loads, but does not render correctly.
>
> The problem is that I have two HtmlTag decorators and the '<tr>' overwrites
> the '<td>'.
>
> How do you alias a decorator in a configuration file? Like on this page
> http://framework.zend.com/manual/en/zend.form.forms.html Using Multiple
> Decorators Of The Same Type

Pretty easily:

    elementdecorators.datatag.type.datatag = "HtmlTag"
    elementdecorators.datatag.options.tag = "td"
    ...
    elementdecorators.rowtag.type.rowtag = "HtmlTag"
    elementdecorators.rowtag.options.tag = "tr"

This will alias the HtmlTag 'td' decorator as 'datatag', and the 'tr'
decorator as 'rowtag'.

--
Matthew Weier O'Phinney
Software Architect       | matthew@...
Zend - The PHP Company   | http://www.zend.com/

 « Return to Thread: Multiple Form Element Decorators in Zend_Config