/ / zend framework2 captcha não render - erro de plugin - zend-framework2

zend framework2 captcha não render - erro de plugin - zend-framework2

Eu tenho este código na minha forma

$this->add(array(
"type" => "ZendFormElementCaptcha",
"name" => "captcha",
"options" => array(
"label" => "Inserisci il codice riportato sotto",
"captcha" => $this->getCaptchaImage(),
),
"attributes"=>array(
"id"=>"captcha",
"tabindex"=>9,
"class"=>"stylish-text-input span3",
"required"=>true
)
));

para adicionar campo

public function getCaptchaImage(){
return $this->captchaImage;
}

private function captchaImage(){
$this->captchaImage =  new  CaptchaImage(  array(
"font" =>  $this->currentFontPath,
"width" => 150,
"height" => 70,
"dotNoiseLevel" => 20,
"lineNoiseLevel" => 1,
"session"=>new container("contact"),
)
);
}

para gerar captcha

em vista

$this->formRow($form->get("captcha"));

eu tenho

ZendViewHelperPluginManager :: get não conseguiu buscar ou criar uma instância para o Captcha

Respostas:

0 para resposta № 1

eu resolvi desta maneira

<?php
$captcha = $form->get("captcha")->getCaptcha();
$captcha->generate();
?>
<img id="captcha-image" width="<?php echo $captcha->getWidth() ?>" height="<?php echo $captcha->getHeight() ?>" src="/images/<?php echo $captcha->getImgUrl() . $captcha->getId() . $captcha->getSuffix(); ?>" alt="<?php echo $captcha->getImgAlt() ?>">