ninja_forms_default_value_filter

Function that filters default values, replacing defined strings with the approparite values.

Description

ninja_forms_default_value_filter( $data, $field_id ); 

Parameters (2)

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

Usage

  1. if ( !function_exists( 'ninja_forms_default_value_filter' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/display/fields/default-value-filter.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_default_value_filter($data, $field_id); 
  12.  

Defined (1)

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

/deprecated/includes/display/fields/default-value-filter.php  
  1. function ninja_forms_default_value_filter( $data, $field_id ) { 
  2. global $ninja_forms_fields, $ninja_forms_loading, $ninja_forms_processing; 
  3.  
  4. if ( isset ( $ninja_forms_loading ) ) { 
  5. $default_value = $ninja_forms_loading->get_field_value( $field_id ); 
  6. $field_type = $ninja_forms_loading->get_field_setting( $field_id, 'type' ); 
  7. } else { 
  8. $default_value = $ninja_forms_processing->get_field_value( $field_id ); 
  9. $field_type = $ninja_forms_processing->get_field_setting( $field_id, 'type' ); 
  10.  
  11. if ( $default_value === false and isset ( $data['default_value'] ) ) { 
  12. $default_value = $data['default_value']; 
  13. if ( is_string( $default_value ) ) 
  14. $default_value = do_shortcode( $default_value ); 
  15.  
  16.  
  17. if ( isset ( $ninja_forms_fields[ $field_type ]['process_field'] ) and $ninja_forms_fields[ $field_type ]['process_field'] ) { 
  18. $data['default_value'] = $default_value; 
  19.  
  20. return $data;