ninja_forms_field_list_add_value

The Ninja Forms ninja forms field list add value function.

Description

ninja_forms_field_list_add_value( $field_id, $x, $conditional, (string) $name, $id, (string) $current = '', (string) $field_data = '' ); 

Parameters (7)

0. $field_id
The field id.
1. $x
The x.
2. $conditional
The conditional.
3. $name (string)
The name.
4. $id
The id.
5. $current — Optional. (string) => ''
The current.
6. $field_data — Optional. (string) => ''
The field data.

Usage

  1. if ( !function_exists( 'ninja_forms_field_list_add_value' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/fields/list.php'; 
  3.  
  4. // The field id. 
  5. $field_id = null; 
  6.  
  7. // The x. 
  8. $x = null; 
  9.  
  10. // The conditional. 
  11. $conditional = null; 
  12.  
  13. // The name. 
  14. $name = ''; 
  15.  
  16. // The id. 
  17. $id = null; 
  18.  
  19. // The current. 
  20. $current = ''; 
  21.  
  22. // The field data. 
  23. $field_data = ''; 
  24.  
  25. // NOTICE! Understand what this does before running. 
  26. $result = ninja_forms_field_list_add_value($field_id, $x, $conditional, $name, $id, $current, $field_data); 
  27.  

Defined (1)

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

/deprecated/includes/fields/list.php  
  1. function ninja_forms_field_list_add_value( $field_id, $x, $conditional, $name, $id, $current = '', $field_data = '' ) { 
  2. $current_value = isset( $current['value']['value'] ) ? $current['value']['value'] : ''; 
  3. $current_label = isset( $current['value']['label'] ) ? $current['value']['label'] : ''; 
  4. $current_calc = isset ( $current['value']['calc'] ) ? $current['value']['calc'] : ''; 
  5.  
  6. $list_show_value = isset( $field_data['list_show_value'] ) ? $field_data['list_show_value'] : ''; 
  7.  
  8. _e( 'Label', 'ninja-forms' ); 
  9. ?> 
  10. <input type="text" name="<?php echo $name;?>[label]" id="<?php echo $id;?>" class="" value="<?php echo $current_label;?>"> 
  11. <?php 
  12. if( $list_show_value == 1 ) { 
  13. _e( 'Value', 'ninja-forms' ); 
  14. ?> 
  15. <input type="text" name="<?php echo $name;?>[value]" id="<?php echo $id;?>" class="ninja-forms-field-<?php echo $field_id;?>-list-option-value" value="<?php echo $current_value;?>"> 
  16. <?php 
  17. }else{ 
  18. ?> 
  19. <input type="hidden" name="<?php echo $name;?>[value]" value="_ninja_forms_no_value"> 
  20. <?php 
  21. _e( 'Calc', 'ninja-forms' ); 
  22. ?> 
  23. <input type="text" name="<?php echo $name;?>[calc]" id="<?php echo $id;?>" class="" value="<?php echo $current_calc;?>"> 
  24. <?php 
  25.