ninja_forms_field_tax_save

Function that runs when our field is saved to make sure that a % is in the tax rate box.

Description

ninja_forms_field_tax_save( $form_id, $data ); 

Parameters (2)

0. $form_id
The form id.
1. $data
The data.

Usage

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

Defined (1)

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

/deprecated/includes/fields/tax.php  
  1. function ninja_forms_field_tax_save( $form_id, $data ) { 
  2. foreach ( $data as $field_id => $val ) { 
  3. $field = ninja_forms_get_field_by_id( $field_id ); 
  4. if ( $field['type'] == '_tax' ) { 
  5. if ( isset ( $val['default_value'] ) ) { 
  6. if ( strpos( $val['default_value'], '%' ) === false ) { 
  7. $data[$field_id]['default_value'] .= '%'; 
  8. return $data;