RWMB_Radio_Field

The Evolved RWMB Radio Field class.

Defined (1)

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

/meta-box/inc/fields/radio.php  
  1. class RWMB_Radio_Field  
  2. /** 
  3. * Get field HTML 
  4. * @param string $html 
  5. * @param mixed $meta 
  6. * @param array $field 
  7. * @return string 
  8. */ 
  9. static function html( $html, $meta, $field )  
  10. $html = ''; 
  11. foreach ( $field['options'] as $key => $value )  
  12. $checked = checked( $meta, $key, false ); 
  13. $id = strstr( $field['id'], '[]' ) ? str_replace( '[]', "-{$key}[]", $field['id'] ) : $field['id']; 
  14. $id = " id='{$id}'"; 
  15. $name = "name='{$field['field_name']}'"; 
  16. $val = " value='{$key}'"; 
  17. $html .= "<label><input type='radio' class='rwmb-radio'{$name}{$id}{$val}{$checked} /> {$value}</label> "; 
  18.  
  19. return $html;