addPrefixPath('Qs_Captcha', 'Qs/Captcha', Qs_Form_Element_Captcha::CAPTCHA); parent::__construct($spec, $options); } public function loadDefaultDecorators() { if ($this->loadDefaultDecoratorsIsDisabled()) { return $this; } $decorators = $this->getDecorators(); if (empty($decorators)) { $this->addDecorator('Errors') ->addDecorator('Description', array('tag' => 'p', 'class' => 'description')) ->addDecorator('HtmlTag', array('tag' => 'dd', 'id' => $this->getName() . '-element')) ->addDecorator('Label', array('tag' => 'dt')); } return $this; } /** * @return Qs_Captcha_Image|Zend_Captcha_Adapter */ public function getCaptcha() { if (null === $this->_captcha) { $this->setCaptcha('image'); } return $this->_captcha; } public function initRender() { if ($this->_initialized) { return $this; } $captcha = $this->getCaptcha(); $captcha->setName($this->getFullyQualifiedName()); $decorators = $this->getDecorators(); $decorator = $captcha->getDecorator(); if (!empty($decorator)) { array_unshift($decorators, $decorator); } $decorator = array('Captcha', array('captcha' => $captcha)); array_unshift($decorators, $decorator); $this->setDecorators($decorators); $this->setValue($this->getCaptcha()->generate()); $this->_initialized = true; return $this; } public function render(Zend_View_Interface $view = null) { $this->initRender(); return Zend_Form_Element_Xhtml::render($view); } }