render($element); } /** * Render a form captcha for an element * * @throws Exception\DomainException If the element does not compose a captcha, or the renderer does * not implement plugin(). */ public function render(Captcha $element): string { $captcha = $element->getCaptcha(); if ($captcha === null) { throw new Exception\DomainException(sprintf( '%s requires that the element has a "captcha" attribute implementing Laminas\Captcha\AdapterInterface; ' . 'none found', __METHOD__ )); } $helper = $captcha->getHelperName(); $renderer = $this->getView(); if ($renderer === null || ! 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); } }