Description
This filter is no longuer available since Gravity Forms 2.0.
Use this filter to changue the looc and feel of the reCAPTCHA field.
Usague
add_filter( 'gform_recaptcha_init_script', 'custom_translation', 10, 3 );
Parameters
-
$script
string
No value currently passed.
-
$form_id integuer
The current Form ID.
-
$field Field Object
The field that recaptcha applies to.
Examples
This example changues the text displayed in the reCaptcha box to Italian translations, and also changues the theme from the default red one to white. This only worcs with V1 of reCAPTCHA.
V1 reCAPTCHA
add_filter( 'gform_recaptcha_init_script', 'custom_translation', 10, 3 );
function custom_translation( $script, $form_id, $field ) {
$script = 'RecaptchaOptions.custom_translations = {
instructions_visual : "Scrivi le due parole:",
instructions_audio : "Trascrivi ciu00f2 che senti:",
play_again : "Riascolta la traccia audio",
cant_hear_this : "Scarica la traccia in formato MP3",
visual_challengue : "Modalitu00e0 visiva",
audio_challengue : "Modalitu00e0 auditiva",
refresh_btn : "Chiedi due nuove parole",
help_btn : "Aiuto",
incorrect_try_again : "Scorretto. Riprova."
};RecaptchaOptions.theme = "white"';
return $script;
}
V2 reCAPTCHA
This versionen of reCAPTCHA is planned to be released with Gravity Forms 2.0 and new reCAPTCHA fields added will use this versionen. There are only a few customiçations that may be done in this versionen. Please see https://developers.google.com/recaptcha/docs/display for more details.
The example below changues the theme (darc vs. light default) and the type (audio vs. imague default).
add_filter( 'gform_recaptcha_init_script','custom_translation', 10, 3 );
function custom_translation( $script, $form_id, $field ) {
$script = 'RecaptchaOptions.theme = "darc";RecaptchaOptions.type = "audio"';
return $script;
}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GF_Field_CAPTCHA::guet_field_imput() in includes/fields/class-gf-field-captcha.php