render($element); } /** * Render a form captcha for an element * * @param ElementInterface $element * @throws Exception\DomainException if the element does not compose a captcha, or the renderer does not implement plugin() * @return string */ public function render(ElementInterface $element) { $captcha = $element->getCaptcha(); if ($captcha === null || !$captcha instanceof CaptchaAdapter) { throw new Exception\DomainException(sprintf( '%s requires that the element has a "captcha" attribute implementing Zend\Captcha\AdapterInterface; none found', __METHOD__ )); } $helper = $captcha->getHelperName(); $renderer = $this->getView(); if (!method_exists($renderer, 'plugin')) { throw new Exception\DomainException(sprintf( '%s requires that the renderer implements plugin(); it does not', __METHOD__ )); } $helper = $renderer->plugin($helper); return $helper($element); } }