ZF-6070: Decorators defined for an element should overrules elementDecorators defined for a form
For the moment, it is impossible to specify elementDecorators together with some exceptions configured for an element in an config file.
For example, I want an ul - li structure. Displaying the label, the element, errors and description. I set the decorators for the form and for the elements (elementDecorator). I don't want to display the label for the submit button. So I add a custom config for the button.
Now, you could think that the elementDecorators would be used for every element except for the elements where you specified a custom decorator set. Just like the order in css: inline style overrules internal style sheets, internal style sheets overrules external stylesheets and external stylesheets overrules the browser default.
This doesn't work. The decorators defined for a single element are ignored.
The problem is that the elements are set and afterwards, the method setElementDecorators is called in the setOptions method of Zend_Form. The function setElementDecorators supports to set only the decorators for a given list of elements but this feature isn't used in the setOptions method. I suggest to look if the elements are set in the given option set. If this is the case and elementDecorators are set too, then lookup all the elements that don't specify custom decorators and use those elements to be used as an argument for the setElementDecorators.
<?xml version="1.0"?> textFoo textBar submitViewHelperHtmlTagliFormElementsHtmlTagul Form ViewHelperErrorsDescriptionpdescription Label HtmlTagli