NF_Fields_ListRadio

Class NF_Fields_RadioList.

Defined (1)

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

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