Example #1
0
 /**
  * Get field HTML
  *
  * @param mixed $meta
  * @param array $field
  *
  * @return string
  */
 static function html($meta, $field)
 {
     $meta = (array) $meta;
     $html = array();
     $tpl = '<label><input %s %s> %s</label>';
     foreach ($field['options'] as $value => $label) {
         $attributes = RWMB_Checkbox_Field::get_attributes($field, $value);
         $html[] = sprintf($tpl, self::render_attributes($attributes), checked(in_array($value, $meta), 1, false), $label);
     }
     return implode('<br>', $html);
 }
Example #2
0
 /**
  * Get the attributes for field
  *
  * @param array $field
  * @param mixed $value
  *
  * @return array
  */
 static function get_attributes($field, $value = null)
 {
     $attributes = RWMB_Checkbox_Field::get_attributes($field, $value);
     $attributes['id'] = false;
     return $attributes;
 }