ninja_forms_field_recaptcha_display
The Ninja Forms ninja forms field recaptcha display function.
Description
Parameters (3)
- 0. $field_id
- The field id.
- 1. $data
- The data.
- 2. $form_id — Optional. (string) =>
''
- The form id.
Usage
if ( !function_exists( 'ninja_forms_field_recaptcha_display' ) ) { require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/fields/recaptcha.php'; } // The field id. $field_id = null; // The data. $data = null; // The form id. $form_id = ''; // NOTICE! Understand what this does before running. $result = ninja_forms_field_recaptcha_display($field_id, $data, $form_id);
Defined (1)
The function is defined in the following location(s).
- /deprecated/includes/fields/recaptcha.php
- function ninja_forms_field_recaptcha_display( $field_id, $data, $form_id = '' ) {
- $settings = get_option( "ninja_forms_settings" );
- $lang = $settings['recaptcha_lang'];
- $siteKey = $settings['recaptcha_site_key'];
- $field_class = ninja_forms_get_field_class( $field_id, $form_id );
- if ( !empty( $siteKey ) ) { ?>
- <input id="ninja_forms_field_<?php echo $field_id;?>" name="ninja_forms_field_<?php echo $field_id;?>" type="hidden" class="<?php echo $field_class;?>" value="" rel="<?php echo $field_id;?>" />
- <div class="g-recaptcha" data-callback="nf_recaptcha_set_field_value" data-sitekey="<?php echo $siteKey; ?>"></div>
- <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang; ?>"> </script>
- <script type="text/javascript">
- function nf_recaptcha_set_field_value(inpval) {
- jQuery("#ninja_forms_field_<?php echo $field_id;?>").val(inpval)
- }
- </script>
- <?php
- }
- }