ZF-9682: Zend_Form_Element_Radio added with Zend_Form with added prefix paths does not load correct Label decorator (unit test + patch provided)

Issue Type: Bug Created: 2010-04-15T02:45:49.000+0000 Last Updated: 2010-05-12T03:05:34.000+0000 Status: Resolved Fix version(s): - 1.10.5 (26/May/10)

Reporter: Raphael Dehousse (thymus) Assignee: Christian Albrecht (alab) Tags: - Zend_Form

Related issues: Attachments: - Zend_Form_Element_Radio-Label_Decorator.patch



Let's say you have a Zend_Form. You add an elements prefix path (addElementsPrefixPath). Then, you build a Zend_Form_Element_Radio and add it.

You will see that your radio element does not have the good label decoractor. Why? Because any Zend_Form_Element loadDefaultDecorators in the construct. The loadDefaultDecorators of radio element do a "getDecorator('Label')" that will load the label decorator if not loaded. Since the addElement add the elements prefix path, it's too late because the label decorator is already loaded. Others element do a addDecorator - that won't load the decorator if it's a string, the decorator will be loaded in the render method.

The workaround is to specify the prefix paths in the constructor of the radio element, but then, first, you have to "duplicate" this add prefix path, second, it's not the same behavior than the others elements.

I will attach a patch for this and a test case a bit later.


Raphaël Dehousse


Posted by Raphael Dehousse (thymus) on 2010-04-15T04:40:14.000+0000

This is a patch for the tests suite of Zend_Form_Element_RadioTests

The test added should fail before the patch and should succeed with the patch.

Patch to apply in tag 1.10.3


Raphaël Dehousse

Posted by Raphael Dehousse (thymus) on 2010-05-11T23:51:43.000+0000

It affects also release 1.10.4

Posted by Christian Albrecht (alab) on 2010-05-12T03:04:42.000+0000

Fixed in trunk r22151 and merged into 1.10 release branch.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.