| 1 | package Data::MuForm::Field::Checkbox; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Checkbox field | ||||||||||||||||||||||||||||
| 3 | 13 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 13 | extends 'Data::MuForm::Field'; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 13 | has 'size' => ( is => 'rw', default => 0 ); | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 13 | has 'checkbox_value' => ( is => 'rw', default => 1 ); | |||||||||||||||||||||||||||
| 10 | 13 | has '+input_without_param' => ( default => 0 ); | |||||||||||||||||||||||||||
| 11 | #has 'option_label' => ( is => 'rw' ); | ||||||||||||||||||||||||||||
| 12 | #has 'option_wrapper' => ( is => 'rw' ); | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 9 | ▶ | sub build_input_type { 'checkbox' } | ||||||||||||||||||||||||||
|
Subroutine
build_input_type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | sub base_render_args { | ||||||||||||||||||||||||||||
| 17 | 11 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
base_render_args: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 18 | 11 | my $args = $self->next::method(@_); | |||||||||||||||||||||||||||
| 19 | 11 | $args->{checkbox_value} = $self->checkbox_value; | |||||||||||||||||||||||||||
| 20 | 11 | $args->{layout_type} = 'checkbox'; | |||||||||||||||||||||||||||
| 21 | 11 | return $args; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | sub validate { | ||||||||||||||||||||||||||||
| 26 | 30 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
validate: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 30 | ▶ | $self->add_error($self->get_message('required'), field_label => $self->loc_label) if( $self->required && !$self->value ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->required and not $self->value
MC/DC100%2/2
$self->required and not $self->value
$self->required
not $self->value
Truth table100%3/3
A and not(B)
A= $self->requiredB= not $self->value
| |||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 13 | 1; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | __END__ | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | =pod | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =head1 NAME | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | Data::MuForm::Field::Checkbox - Checkbox field | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | =head1 VERSION | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | version 0.04 | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | Render args: | ||||||||||||||||||||||||||||
| 50 | option_label | ||||||||||||||||||||||||||||
| 51 | option_wrapper | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =head1 NAME | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | Data::MuForm::Field::Checkbox | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | Gerda Shank | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | This software is copyright (c) 2017 by Gerda Shank. | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 66 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | =cut | ||||||||||||||||||||||||||||