ninja_forms_field_recaptcha_display

The Ninja Forms ninja forms field recaptcha display function.

Description

ninja_forms_field_recaptcha_display( $field_id, $data, (string) $form_id = '' ); 

Parameters (3)

0. $field_id
The field id.
1. $data
The data.
2. $form_id — Optional. (string) => ''
The form id.

Usage

  1. if ( !function_exists( 'ninja_forms_field_recaptcha_display' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/fields/recaptcha.php'; 
  3.  
  4. // The field id. 
  5. $field_id = null; 
  6.  
  7. // The data. 
  8. $data = null; 
  9.  
  10. // The form id. 
  11. $form_id = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = ninja_forms_field_recaptcha_display($field_id, $data, $form_id); 
  15.  

Defined (1)

The function is defined in the following location(s).

/deprecated/includes/fields/recaptcha.php  
  1. function ninja_forms_field_recaptcha_display( $field_id, $data, $form_id = '' ) { 
  2. $settings = get_option( "ninja_forms_settings" ); 
  3. $lang = $settings['recaptcha_lang']; 
  4. $siteKey = $settings['recaptcha_site_key']; 
  5. $field_class = ninja_forms_get_field_class( $field_id, $form_id ); 
  6. if ( !empty( $siteKey ) ) { ?> 
  7. <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;?>" /> 
  8. <div class="g-recaptcha" data-callback="nf_recaptcha_set_field_value" data-sitekey="<?php echo $siteKey; ?>"></div> 
  9. <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang; ?>"> </script> 
  10. <script type="text/javascript"> 
  11. function nf_recaptcha_set_field_value(inpval) { 
  12. jQuery("#ninja_forms_field_<?php echo $field_id;?>").val(inpval) 
  13. </script> 
  14. <?php