« Return to Thread: Multiple Form Element Decorators in Zend_Config

Multiple Form Element Decorators in Zend_Config

by dvhas :: Rate this Message:

Reply to Author | View in Thread


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>"

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 Using Multiple Decorators Of The Same Type

The following was my original code, it renders like I expect (and want).


$this->setElementDecorators(
  array(
  array('ViewHelper'), // prints the element
  array( array('datatag' => 'HtmlTag'), array('tag' => '<td>' )), // wrap the element in a <dt>
  array('Label', array('tag' => '<th>')), // prepend the label and wrap it in a <th>
  array('HtmlTag', array('tag' => '<tr>')) // wrap the whole thing in a <tr>
  )
);

I want to use this rendering on many custom forms.

 « Return to Thread: Multiple Form Element Decorators in Zend_Config