/** * Builds a new HTML input field with a label wrapped around it, * useful for making radio buttons. * * <label><input type="$type" name="$name" value="$value" />$title</label> * * @param string The name attribute of the input tag * @param string the text for the label * @param string The type attribute of the input tag * @param string The value attribute of the input tag * @param string If this parameter is the same as the value parameter, set this as default * @return Sprocket The label tag, with Input tag nested */ public static function LabeledInput($name, $title, $type, $value, $default) { $label = new Sprocket('label'); $input = $label->input(); $input->type = $type; $input->name = $name; $input->value = $value; if ($value == $default) { $input->selected = 'selected'; } $label->add($title); return $label; }