Developer Corner

Add the Captcha to your domain model

Add this field to your domain model class:

1
2
3
4
5
/**
 * @var string
 * @validate NotEmpty, \Haffner\JhCaptcha\Validation\Validator\ReCaptchaValidator
 */
protected $captchaResponse;

and getter and setter functions:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
/**
 * Sets the captchaResponse
 *
 * @param string $captchaResponse
 * @return void
 */
public function setCaptchaResponse($captchaResponse) {
    $this->captchaResponse = $captchaResponse;
}

/**
 * Returns the captchaResponse
 *
 * @return string
 */
public function getCaptchaResponse() {
    return $this->captchaResponse;
}

Add the Captcha to your Fluid template

1
2
3
4
{namespace jhcaptcha = Haffner\JhCaptcha\ViewHelpers}

<jhcaptcha:reCaptcha />
<f:form.textfield id="captchaResponse" type="hidden" property="captchaResponse" />