ZF-9151: Zend_Dojo_View_Helper path overrides Zend_View_Helper path
Description
Cannot believe it, first time I use Zend_Dojo and I'm finding a major bug in the first 10 minutes (with another hour of following backtraces)... anyway, following problem:
When registering the Zend_Dojo_View_Helper path in the view, and trying to render a usual form (which is a usual Zend_Form without dijits nor dojo-enabled), Zend_Form runs through its own decorators, of which one of the default decorators wants to call the "Form" view helper. As it tries so, a naming conflict hinders it from getting Zend_View_Helper_Form, and Zend_Dojo_View_Helper_Form is rendered instead.
This triggers Zend_Dojo_View_Helper_Dijit to be loaded by Zend_View_Abstract, which then calls the setView() method on this view helper, which finally enables Zend_Dojo_View_Helper_DojoContainer, without any need of it to be enabled. Additionally, it creates JavaScript code for the Dijit view helper, which is not required at all.
Generated JS code, which causes a complete DOM scan:
Just to make it even more interesting, it will also generate the following JavaScript error:
Error: Could not load 'dijit.form.Form'; last tried '../dijit/form/Form.js'
File: http://dasprids.local/media/js/dojo.js
Line: 16
Using dojo.js from http://download.dojotoolkit.org/release-1.4.1/
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2010-02-11T13:34:43.000+0000
This is a known issue, and I plan to create a different decorator for this and the Textarea dijit as well so that naming collisions with these two won't occur. Unfortunately, I don't have a workaround possible for you to try in the immediate future.
Posted by Ben Scholzen (dasprid) on 2010-02-11T13:41:18.000+0000
Any chance to fix that in a mini release, or would that be considered a BC break which has to wait for 2.0? Also, will there be any steps taken in 2.0 that those naming conflicts cannot occur anymore?
Posted by Ben Scholzen (dasprid) on 2010-02-13T07:33:12.000+0000
For those of you interested in a workaround:
Extend the Form-decorator in your application library, and set $_helper = 'formForm'. Then extends the Form-view-helper in your application library as FormForm, and route the formForm() call to form(). This will avoid the naming conflict for now.