public function render(ElementInterface $element)
    {
        $attributes = $element->getAttributes();
        $captcha = $element->getCaptcha();

        if ($captcha === null || ! $captcha instanceof CaptchaAdapter) {
            throw new Exception\DomainException(sprintf(
                '%s requires that the element has a "captcha" is an instance of LosReCaptcha\Captcha\ReCaptcha',
                __METHOD__
            ));
        }

        $name          = $element->getName();
        $id            = isset($attributes['id']) ? $attributes['id'] : $name;
        $responseName  = empty($name) ? 'recaptcha_response_field' : $name . '[recaptcha_response_field]';
        $responseId    = $id . '-response';

        $markup = $captcha->getService()->getHtml($name);
        $hidden = $this->renderHiddenInput($responseName, $responseId);
        $js     = $this->renderJsEvents($responseId);

        return $hidden . $markup . $js;
    }
public function render(ElementInterface $element)
    {
        $attributes = $element->getAttributes();
        $captcha = $element->getCaptcha();

        if ($captcha === null || ! $captcha instanceof CaptchaAdapter) {
            throw new Exception\DomainException(sprintf(
                '%s requires that the element has a "captcha" is an instance of LosReCaptcha\Captcha\ReCaptcha',
                __METHOD__
            ));
        }

        $name          = $element->getName();
        $id            = isset($attributes['id']) ? $attributes['id'] : $name;
        $responseName  = empty($name) ? 'recaptcha_response_field' : $name . '[recaptcha_response_field]';
        $responseId    = $id . '-response';

        $markup = $captcha->getService()->getHtml($name);
        $hidden = $this->renderHiddenInput($responseName, $responseId);
        $js     = $this->renderJsEvents($responseId);

        return $hidden . $markup . $js;
    }
public function render ( ElementInterface $ element ) { $ attributes = $ element -> getAttributes ( ) ; $ captcha = $ element -> getCaptcha ( ) ; if ( $ captcha === null || ! $ captcha instanceof CaptchaAdapter ) { throw new Exception \ DomainException ( sprintf ( '%s requires that the element has a "captcha" is an instance of LosReCaptcha\Captcha\ReCaptcha' , __METHOD__ ) ) ; } $ name = $ element -> getName ( ) ; $ id = isset ( $ attributes [ 'id' ] ) ? $ attributes [ 'id' ] : $ name ; $ responseName = empty ( $ name ) ? 'recaptcha_response_field' : $ name . '[recaptcha_response_field]' ; $ responseId = $ id . '-response' ; $ markup = $ captcha -> getService ( ) -> getHtml ( $ name ) ; $ hidden = $ this -> renderHiddenInput ( $ responseName , $ responseId ) ; $ js = $ this -> renderJsEvents ( $ responseId ) ; return $ hidden . $ markup . $ js ; }
Render ReCaptcha form elements

@param  ElementInterface $element
@throws Exception\DomainException
@return string
Render ReCaptcha form elements