package QBit::WebInterface::Controller::BEMHTML::Form::Field::radio;

use qbit;

use base qw(QBit::WebInterface::Controller::Form::Field);

sub as_html {
    my ($self) = @_;

    return ${$self->form->controller->_process_template('common/form/radio.bem.tt2', vars => {field => $self})};
}

sub value_from_request {
    my ($self, $request) = @_;

    my $value =
      $self->{'multi'} ? $request->param_array($self->{'name'}) : $request->param($self->{'name'}, $self->{'value'});
    $value = '' unless defined($value);

    return $value;
}

1;
