form::radio PHP Method

radio() public static method

public static radio ( $name, $value = null, $checked = false, $attributes = [] )
    public static function radio($name, $value = null, $checked = false, $attributes = array())
    {
        if (is_null($value)) {
            $value = $name;
        }
        return static::checkable('radio', $name, $value, $checked, $attributes);
    }

Usage Example

Example #1
0
 function yesno($name, $value = '')
 {
     // 1||0//Y||N//y||n//YES||NO - autodetect
     $html = "";
     switch ($value) {
         case '0':
         case '1':
             $values = array(1, 0);
             break;
         case 'Y':
         case 'N':
             $values = array('Y', 'N');
         case 'y':
         case 'n':
             $values = array('y', 'n');
         case 'YES':
         case 'NO':
             $values = array('YES', 'NO');
         default:
             $values = array('YES', 'NO');
     }
     $html .= form::radio($name, $values[0], Lang::item('common.yes'), $value);
     $html .= form::radio($name, $values[1], Lang::item('common.no'), $value);
     return $html;
 }
All Usage Examples Of form::radio