Issues

ZF-9338: Zend_Form_Element_Captcha loads two decorators in its render() function shd be in loadDefaultDecorator();

Description

Zend_Form_Element_Captcha should use its loadDefaultDecorators() method to add two captcha specific decorators instead of using its render() method for this purpose , as a result currently its impossible to disable captcha decorator ,currently if someone like to create its own captcha decorator has to create his own captcha element.

Comments

Decorating the Zend_Form_Element_Captcha seems almost imposible. Please fix this issue!


$form = new Zend_Form();
$form->addElement('captcha', 'CaptchaName',
          array('captcha' => new Zend_Captcha_Figlet(),
                        'prefixPath' => array('decorator' => array('App_Form_Decorator' => 'App/Form/Decorator/'))));
$form->render();
echo '
' . var_export(array_keys($form->CaptchaName->getDecorators()),1) . '
'; array ( 0 => 'App_Form_Decorator_Captcha', 1 => 'App_Form_Decorator_Captcha_Word', 2 => 'Zend_Form_Decorator_Errors', 3 => 'Zend_Form_Decorator_Description', 4 => 'Zend_Form_Decorator_HtmlTag', 5 => 'Zend_Form_Decorator_Label', )

Closing as won't fix as the Decorators are probably going to be refactored in 2.0 - and until then the suggested workaround seems sufficient for me.