+sub radio_button_tag {
+ my $self = shift;
+ my $name = shift;
+ my %attributes = _hashify(@_);
+
+ $attributes{value} = 1 unless defined $attributes{value};
+ $attributes{id} ||= $self->name_to_id($name . "_" . $attributes{value});
+ my $label = delete $attributes{label};
+
+ if ($attributes{checked}) {
+ $attributes{checked} = 'checked';
+ } else {
+ delete $attributes{checked};
+ }
+
+ my $code = $self->html_tag('input', undef, %attributes, name => $name, type => 'radio');
+ $code .= $self->html_tag('label', $label, for => $attributes{id}) if $label;
+
+ return $code;
+}
+