ninja_forms_filter_restore_progress

Used to restore the progress of a user.

Description

ninja_forms_filter_restore_progress( $data, $field_id ); 

If the global processing variable $ninja_forms_processing is set, filter the default_value for each field.

Parameters (2)

0. $data
The data.
1. $field_id
The field id.

Usage

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

Defined (1)

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

/deprecated/includes/display/fields/restore-progress.php  
  1. function ninja_forms_filter_restore_progress( $data, $field_id ) { 
  2. global $ninja_forms_loading, $ninja_forms_processing, $ninja_forms_fields; 
  3.  
  4. if ( isset ( $ninja_forms_loading ) ) { 
  5. $field_row = $ninja_forms_loading->get_field_settings( $field_id ); 
  6. } else if ( isset ( $ninja_forms_processing ) ) { 
  7. $field_row = $ninja_forms_processing->get_field_settings( $field_id ); 
  8.  
  9. if ( isset ( $field_row['type'] ) ) { 
  10. $field_type = $field_row['type']; 
  11. } else { 
  12. $field_type = ''; 
  13.  
  14. if ( isset( $ninja_forms_fields[$field_type]['esc_html'] ) ) { 
  15. $esc_html = $ninja_forms_fields[$field_type]['esc_html']; 
  16. } else { 
  17. $esc_html = true; 
  18.  
  19. if ( is_object( $ninja_forms_processing ) ) { 
  20. $clear_form = $ninja_forms_processing->get_form_setting( 'clear_complete' ); 
  21. $process_complete = $ninja_forms_processing->get_form_setting( 'processing_complete' ); 
  22. if ( $process_complete != 1 OR ( $process_complete == 1 AND $clear_form != 1 ) ) { 
  23. if ( $ninja_forms_processing->get_field_value( $field_id ) !== false ) { 
  24.  
  25. if ( $esc_html ) { 
  26. if( is_array( $ninja_forms_processing->get_field_value( $field_id ) ) ) { 
  27. $default_value = ninja_forms_esc_html_deep( $ninja_forms_processing->get_field_value( $field_id ) ); 
  28. } else { 
  29. $default_value = esc_html( $ninja_forms_processing->get_field_value( $field_id ) ); 
  30. } else { 
  31. $default_value = $ninja_forms_processing->get_field_value( $field_id ); 
  32. $data['default_value'] = $default_value; 
  33.  
  34. return $data;