SimpleCalendarAdminFieldsRadio

Radio input field.

Defined (1)

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

/includes/admin/fields/radio.php  
  1. class Radio extends Field { 
  2.  
  3. /** 
  4. * Inline radios. 
  5. * @access private 
  6. * @var bool 
  7. */ 
  8. private $inline = false; 
  9.  
  10. /** 
  11. * Construct. 
  12. * @since 3.0.0 
  13. * @param array $field 
  14. */ 
  15. public function __construct( $field ) { 
  16.  
  17. $this->type_class = 'simcal-field-radios'; 
  18. $this->inline = isset( $field['inline'] ) ? ( 'inline' == $field['inline'] ? true : false ) : false; 
  19.  
  20. parent::__construct( $field ); 
  21.  
  22. /** 
  23. * Outputs the field markup. 
  24. * @since 3.0.0 
  25. */ 
  26. public function html() { 
  27.  
  28. ?> 
  29. <fieldset id="<?php echo $this->id; ?>" 
  30. class="<?php echo $this->class; ?>" 
  31. <?php echo $this->style ? 'style="' . $this->style .'"' : ''; ?>> 
  32. <?php 
  33.  
  34. echo $this->description ? '<p class="description">' . wp_kses_post( $this->description ) . '</p>' : ''; 
  35.  
  36. if ( ! empty( $this->title ) ) : 
  37.  
  38. ?> 
  39. <legend class="screen-reader-text"> 
  40. <span><?php echo $this->title; ?></span> 
  41. </legend> 
  42. <?php 
  43.  
  44. endif; 
  45.  
  46. ?> 
  47. <ul <?php echo $this->inline === true ? 'class="simcal-field-radios-inline"' : ''; ?>> 
  48. <?php foreach ( $this->options as $option => $name ) : ?> 
  49. <li> 
  50. <label for="<?php echo $this->id . '-' . trim( strval( $option ) ); ?>"> 
  51. <input name="<?php echo $this->name; ?>" 
  52. id="<?php echo $this->id . '-' . trim( strval( $option ) ); ?>" 
  53. class="simcal-field simcal-field-radio" 
  54. type="radio" 
  55. value="<?php echo trim( strval( $option ) ); ?>" 
  56. <?php echo $this->attributes; ?> 
  57. <?php checked( $option, $this->value, true ); ?> 
  58. /> 
  59. <?php echo esc_attr( $name ); ?> 
  60. </label> 
  61. </li> 
  62. <?php endforeach; ?> 
  63. </ul> 
  64.  
  65. <?php echo $this->tooltip; ?> 
  66.  
  67. </fieldset> 
  68. <?php 
  69.  
  70.