cf_ajax_setatts

The Caldera Forms cf ajax setatts function.

Description

cf_ajax_setatts( $atts, $form ); 

Parameters (2)

0. $atts
The atts.
1. $form
The form.

Usage

  1. if ( !function_exists( 'cf_ajax_setatts' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'caldera-forms/includes/ajax.php'; 
  3.  
  4. // The atts. 
  5. $atts = null; 
  6.  
  7. // The form. 
  8. $form = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = cf_ajax_setatts($atts, $form); 
  12.  

Defined (1)

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

/includes/ajax.php  
  1. function cf_ajax_setatts($atts, $form) { 
  2. global $current_form_count; 
  3.  
  4. $post_disable = 0; 
  5. if ( isset( $form[ 'form_ajax_post_submission_disable' ] ) ) { 
  6. $post_disable = $form[ 'form_ajax_post_submission_disable' ]; 
  7.  
  8. $resatts = array( 
  9. 'data-target' => '#caldera_notices_'.$current_form_count,  
  10. 'data-template' => '#cfajax_'.$form['ID'].'-tmpl',  
  11. 'data-cfajax' => $form['ID'],  
  12. 'data-load-element' => '_parent',  
  13. 'data-load-class' => 'cf_processing',  
  14. 'data-post-disable' => $post_disable,  
  15. 'data-action' => 'cf_process_ajax_submit',  
  16. 'data-request' => cf_ajax_api_url( $form[ 'ID' ] ),  
  17. ); 
  18.  
  19. if( !empty( $form['custom_callback'] ) ) { 
  20. $resatts['data-custom-callback'] = $form['custom_callback']; 
  21. if( !empty( $form['has_ajax_callback']) && !empty( $form['inhibit_notice'] ) ) { 
  22. $resatts['data-inhibitnotice'] = true; 
  23.  
  24. if(!empty($form['hide_form'])) { 
  25. $resatts['data-hiderows'] = "true"; 
  26.  
  27. return array_merge($atts, $resatts); 
  28.