/deprecated/includes/display/fields/default-value-filter.php

  1. <?php if ( ! defined( 'ABSPATH' ) ) exit; 
  2.  
  3. /** 
  4. * 
  5. * Function that filters default values, replacing defined strings with the approparite values. 
  6. * 
  7. * @since 2.4 
  8. * @return $data 
  9. */ 
  10.  
  11. function ninja_forms_default_value_filter( $data, $field_id ) { 
  12. global $ninja_forms_fields, $ninja_forms_loading, $ninja_forms_processing; 
  13.  
  14. if ( isset ( $ninja_forms_loading ) ) { 
  15. $default_value = $ninja_forms_loading->get_field_value( $field_id ); 
  16. $field_type = $ninja_forms_loading->get_field_setting( $field_id, 'type' ); 
  17. } else { 
  18. $default_value = $ninja_forms_processing->get_field_value( $field_id ); 
  19. $field_type = $ninja_forms_processing->get_field_setting( $field_id, 'type' ); 
  20.  
  21. if ( $default_value === false and isset ( $data['default_value'] ) ) { 
  22. $default_value = $data['default_value']; 
  23. if ( is_string( $default_value ) ) 
  24. $default_value = do_shortcode( $default_value ); 
  25.  
  26.  
  27. if ( isset ( $ninja_forms_fields[ $field_type ]['process_field'] ) and $ninja_forms_fields[ $field_type ]['process_field'] ) { 
  28. $data['default_value'] = $default_value; 
  29.  
  30. return $data; 
  31.  
  32. add_filter( 'ninja_forms_field', 'ninja_forms_default_value_filter', 7, 2 ); 
.