ninja_forms_register_field_calc

Function to register a new field for calculations.

Description

ninja_forms_register_field_calc(); 

Usage

  1. if ( !function_exists( 'ninja_forms_register_field_calc' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/fields/calc.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ninja_forms_register_field_calc(); 
  7.  

Defined (1)

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

/deprecated/includes/fields/calc.php  
  1. function ninja_forms_register_field_calc() { 
  2. $args = array( 
  3. 'name' => __( 'Calculation', 'ninja-forms' ),  
  4. 'sidebar' => 'template_fields',  
  5. 'edit_function' => 'ninja_forms_field_calc_edit',  
  6. 'display_function' => 'ninja_forms_field_calc_display',  
  7. 'group' => 'standard_fields',  
  8. 'edit_conditional' => true,  
  9. 'edit_req' => false,  
  10. 'edit_label' => false,  
  11. 'edit_label_pos' => false,  
  12. 'edit_custom_class' => false,  
  13. 'edit_help' => false,  
  14. //'process_field' => false,  
  15. //'pre_process' => 'ninja_forms_field_calc_strip_currency_symbol',  
  16. 'edit_options' => array( 
  17. array( 
  18. 'type' => 'hidden',  
  19. 'name' => 'payment_field_group',  
  20. 'default' => 1,  
  21. ),  
  22. array( 
  23. 'type' => 'hidden',  
  24. 'name' => 'payment_total',  
  25. //'label' => __( 'Total', 'ninja-forms' ),  
  26. ),  
  27. array( 
  28. 'type' => 'hidden',  
  29. 'name' => 'payment_sub_total',  
  30. //'label' => __( 'Sub Total', 'ninja-forms' ),  
  31. ),  
  32. array( 
  33. 'type' => 'text',  
  34. 'name' => 'calc_places',  
  35. 'label' => __( 'Number of decimal places.', 'ninja-forms' ),  
  36. 'default' => 2,  
  37. ),  
  38. ),  
  39. 'conditional' => array( 
  40. 'value' => array( 
  41. 'type' => 'text',  
  42. ),  
  43. ),  
  44. ); 
  45.  
  46. ninja_forms_register_field( '_calc', $args );