NF_Fields_ListSelect

Class NF_Fields_SelectList.

Defined (1)

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

/includes/Fields/ListSelect.php  
  1. class NF_Fields_ListSelect extends NF_Abstracts_List 
  2. protected $_name = 'listselect'; 
  3.  
  4. protected $_type = 'listselect'; 
  5.  
  6. protected $_nicename = 'Select'; 
  7.  
  8. protected $_section = 'common'; 
  9.  
  10. protected $_icon = 'chevron-down'; 
  11.  
  12. protected $_templates = 'listselect'; 
  13.  
  14. protected $_old_classname = 'list-select'; 
  15.  
  16. public function __construct() 
  17. parent::__construct(); 
  18.  
  19. $this->_nicename = __( 'Select', 'ninja-forms' ); 
  20.  
  21. add_filter( 'ninja_forms_merge_tag_calc_value_' . $this->_type, array( $this, 'get_calc_value' ), 10, 2 ); 
  22.  
  23. public function get_calc_value( $value, $field ) 
  24. if( isset( $field[ 'options' ] ) ) { 
  25. foreach ($field['options'] as $option ) { 
  26. if( ! isset( $option[ 'value' ] ) || $value != $option[ 'value' ] || ! isset( $option[ 'calc' ] ) ) continue; 
  27. return $option[ 'calc' ]; 
  28. return $value;