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
Parameters (2)
- 0. $form_id
- The form id.
- 1. $data
- The data.
Usage
if ( !function_exists( 'ninja_forms_field_tax_save' ) ) { require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/fields/tax.php'; } // The form id. $form_id = null; // The data. $data = null; // NOTICE! Understand what this does before running. $result = ninja_forms_field_tax_save($form_id, $data);
Defined (1)
The function is defined in the following location(s).
- /deprecated/includes/fields/tax.php
- function ninja_forms_field_tax_save( $form_id, $data ) {
- foreach ( $data as $field_id => $val ) {
- $field = ninja_forms_get_field_by_id( $field_id );
- if ( $field['type'] == '_tax' ) {
- if ( isset ( $val['default_value'] ) ) {
- if ( strpos( $val['default_value'], '%' ) === false ) {
- $data[$field_id]['default_value'] .= '%';
- }
- }
- }
- }
- return $data;
- }