RWMB_Checkbox_List_Field

The Evolved RWMB Checkbox List Field class.

Defined (1)

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

/meta-box/inc/fields/checkbox-list.php  
  1. class RWMB_Checkbox_List_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. if ( ! is_array( $meta ) ) 
  11. $meta = (array) $meta; 
  12.  
  13. $html = array(); 
  14.  
  15. foreach ( $field['options'] as $key => $value )  
  16. $checked = checked( in_array( $key, $meta ), true, false ); 
  17. $name = "name='{$field['field_name']}'"; 
  18. $val = " value='{$key}'"; 
  19. $html[] = "<label><input type='checkbox' class='rwmb-checkbox-list'{$name}{$val}{$checked} /> {$value}</label>"; 
  20. return implode( '<br />', $html );