ReduxFramework_radio

The Gravity Forms Advanced File Uploader ReduxFramework radio class.

Defined (1)

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

/inc/ReduxFramework/ReduxCore/inc/fields/radio/field_radio.php  
  1. class ReduxFramework_radio { 
  2.  
  3. /** 
  4. * Field Constructor. 
  5. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function 
  6. * @since ReduxFramework 1.0.0 
  7. */ 
  8. function __construct( $field = array(), $value = '', $parent ) { 
  9. $this->parent = $parent; 
  10. $this->field = $field; 
  11. $this->value = $value; 
  12.  
  13. /** 
  14. * Field Render Function. 
  15. * Takes the vars and outputs the HTML for the field in the settings 
  16. * @since ReduxFramework 1.0.0 
  17. */ 
  18. function render() { 
  19.  
  20. if ( ! empty( $this->field['data'] ) && empty( $this->field['options'] ) ) { 
  21. if ( empty( $this->field['args'] ) ) { 
  22. $this->field['args'] = array(); 
  23. $this->field['options'] = $this->parent->get_wordpress_data( $this->field['data'], $this->field['args'] ); 
  24.  
  25. $this->field['data_class'] = ( isset( $this->field['multi_layout'] ) ) ? 'data-' . $this->field['multi_layout'] : 'data-full'; 
  26.  
  27. if ( ! empty( $this->field['options'] ) ) { 
  28. echo '<ul class="' . $this->field['data_class'] . '">'; 
  29.  
  30. foreach ( $this->field['options'] as $k => $v ) { 
  31. echo '<li>'; 
  32. echo '<label for="' . $this->field['id'] . '_' . array_search( $k, array_keys( $this->field['options'] ) ) . '">'; 
  33. echo '<input type="radio" class="radio ' . $this->field['class'] . '" id="' . $this->field['id'] . '_' . array_search( $k, array_keys( $this->field['options'] ) ) . '" name="' . $this->field['name'] . $this->field['name_suffix'] . '" value="' . $k . '" ' . checked( $this->value, $k, false ) . '/>'; 
  34. echo ' <span>' . $v . '</span>'; 
  35. echo '</label>'; 
  36. echo '</li>'; 
  37. //foreach 
  38.  
  39. echo '</ul>'; 
  40. } //function 
  41. } //class