DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
Integration¶
Use in your extension¶
To make use of this extension is quite easy as there is only one service needed. By instantiating the EvowebRecaptchaServicesCaptchaService it’s possible to render and validate the captcha. Beside the service there are a ViewHelper and a Validator for use in extbase extensions.
Integration in your own code¶
Rendering hole captcha¶
To render you are able to let the service take care of the output by calling getReCaptcha.
$output = \Evoweb\Recaptcha\Services\CaptchaService::getInstance()->getReCaptcha();
Please keep in mind that it only renders the captcha. If you need something to trigger the validation in your controller it’s up to you to add the code.
Render on your own¶
If you prefer to render on your own its possible to let the service prepare the settings for you.
$captchaService = \Evoweb\Recaptcha\Services\CaptchaService::getInstance();
$configuration = $captchaService->getConfiguration();
$showCaptcha = $captchaService->getShowCaptcha();
By using this you need to render the html completely on your own.
Integration in extbase extension¶
Rendering the captcha¶
For rendering the captcha in a fluid template there is a ViewHelper that prepares the configuration and then renders the captcha.
<r:form.recaptcha>
<f:if condition="{showCaptcha}">
<f:then>
<f:form.hidden property="{name}" value="1" />
<div class="{configuration.captchaCssClass}" data-sitekey="{configuration.public_key}{f:if(condition: configuration.lang, then: '?hl=de')}"></div>
</f:then>
<f:else>
<div class="recaptcha-development-mode">
Development mode active. Do not expect the captcha to appear.
</div>
</f:else>
</f:if>
</r:form.recaptcha>