ZF-5304: Applying custom decorators to an Button Element, can't be done


Because of strong typing in the Zend_Dojo_View_Helper_Button class, function button(), argument 4 is null when a decorator is set.

Same with SubmitButton, others not checked.

$this->addElement ( 'Button', 'closeBtn', array ('label' => 'Close', 'class' => 'CloseBtn', 'decorators' => array ( 'ViewHelper' ) ) );

-- or -- $this->addElement ( 'Button', 'closeBtn', array ('label' => 'Close', 'class' => 'CloseBtn' ) ); $this->setElementDecorators( array ('ViewHelper' ) );


Apparently this happens only when using Zend_Form_Decorator_ViewHelper as a decorator, but does not happen when using Zend_Dojo_Form_Decorator_DijitElement.

Question is, should a Zend_Dojo_Form_Element be able to use a Zend_Form_Decorator? If no, then, I think, this is not an issue.

You can use any decorator, but we can't guarantee that it will work if you use something other than DijitElement when using Dojo form elements. I'm closing as "won't fix", as the solution is simply to use DijitElement instead of ViewHelper as the decorator.