I have to say this isn't working for me and I have had no success whatsoever setting decorators on a per element basis in an ini file, using setDecorators from the form or controller it's trivial. My form is a collection of subforms although I don't see if that's relevant in any way.

I have this in a config file :

; Global Element Decorators
form.elementDecorators.decorator = "ViewHelper"
form.elementDecorators.error.decorator = "Errors"
form.elementDecorators.description.decorator = "Description"

form.elementDecorators.label.decorator = "HtmlTag"
form.elementDecorators.label.options.tag = "div"
form.elementDecorators.label.placement = "prepend"

form.elementDecorators.formElements.decorator = "HtmlTag"
form.elementDecorators.formElements.options.tag = "td"
form.elementDecorators.formElements.options.class = "entry"
; Group Decorators
form.displayGroupDecorators.decorator = "FormElements"
form.displayGroupDecorators.formElements.decorator = "HtmlTag"
form.displayGroupDecorators.formElements.options.tag = "tr"
form.displayGroupDecorators.formElements.options.class = "newrow"

On 19 Mar 2009, at 12:13, Matthew Weier O'Phinney wrote:

-- Ian Spare <[email protected]> wrote
(on Thursday, 19 March 2009, 07:37 AM +0100):
I'm struggling a little to setup an ini file the way I want.

I want to specify some decorators and just can't seem to do it so I
ended up grabbing the element and modifying it like this :

$buttonDecorators       = array('ViewHelper', array(array('data' =>
'HtmlTag'), array('tag' => 'td', 'class' => 'xxxx')),
array(array('label' => 'HtmlTag'), array('tag' => 'div', 'placement' =>
'prepend')), array(array('row' => 'HtmlTag'),
        array('tag' => 'div')), );
$deleteButton = $subform[$counter]->getElement('delete');
$deleteButton->setDecorators($buttonDecorators);

which works fine but it's horrible :( can anyone enlighten me how to do
this in the ini file?

form.delete.decorators.data.decorator = "HtmlTag"
form.delete.decorators.data.options.tag = "td"
form.delete.decorators.data.options.class = "xxxx"
form.delete.decorators.label.decorator = "Label"
form.delete.decorators.label.options.tag = "dev"
form.delete.decorators.label.options.placement = "prepend"
form.delete.decorators.row.decorator = "HtmlTag"
form.delete.decorators.row.options.tag = "div"

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

Ian Spare
Email     :    [email protected],
Website :    http://snowslider.net




Reply via email to