Example #1
0
 public function radioButton($model, $attribute, $options = array())
 {
     $name = isset($options['name']) ? $options['name'] : CHtml::getInputName($model, $attribute);
     $value = CHtml::getAttributeValue($model, $attribute);
     if (!array_key_exists('value', $options)) {
         $options['value'] = '1';
     }
     $checked = "{$value}" === "{$options['value']}";
     if (!array_key_exists('id', $options)) {
         $options['id'] = CHtml::getInputId($model, $attribute);
     }
     return CHtml::radio($name, $checked, $options);
 }