| 1 | package HTML::FormHandler::Widget::Field::Checkbox; | ||||||||||||||||||||
| 2 | # ABSTRACT: HTML attributes field role | ||||||||||||||||||||
| 3 | 24 | $HTML::FormHandler::Widget::Field::Checkbox::VERSION = '0.410002'; | |||||||||||||||||||
| 4 | 24 | ▶ | use Moose::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 24 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 24 | ▶ | use HTML::FormHandler::Render::Util ('process_attrs'); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 44 | ▶ | sub render_element { | ||||||||||||||||||
|
Subroutine
render_element: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||
| 10 | 44 | my ( $self, $result ) = @_; | |||||||||||||||||||
| 11 | 44 | ▶ | $result ||= $self->result; | ||||||||||||||||||
|
Condition33%1/3
$result ||= $self->result
MC/DC0%0/2
$result ||= $self->result
$result
$self->result
Truth table33%1/3
A ||= B
A= $resultB= $self->result
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 44 | my $checkbox_value = $self->checkbox_value; | |||||||||||||||||||
| 14 | 44 | my $output = '<input type="checkbox" name="' | |||||||||||||||||||
| 15 | . $self->html_name . '" id="' . $self->id . '" value="' | ||||||||||||||||||||
| 16 | . $self->html_filter($checkbox_value) . '"'; | ||||||||||||||||||||
| 17 | 44 | ▶ | $output .= ' checked="checked"' | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 18 | if $result->fif eq $checkbox_value; | ||||||||||||||||||||
| 19 | 44 | $output .= process_attrs($self->element_attributes($result)); | |||||||||||||||||||
| 20 | 44 | $output .= ' />'; | |||||||||||||||||||
| 21 | 44 | return $output; | |||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 43 | ▶ | sub render { | ||||||||||||||||||
|
Subroutine
render: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||
| 25 | 43 | my ( $self, $result ) = @_; | |||||||||||||||||||
| 26 | 43 | ▶ | $result ||= $self->result; | ||||||||||||||||||
|
Condition66%2/3
$result ||= $self->result
MC/DC0%0/2
$result ||= $self->result
$result
$self->result
Truth table66%2/3
A ||= B
A= $resultB= $self->result
| |||||||||||||||||||||
| 27 | 43 | ▶ | die "No result for form field '" . $self->full_name . "'. Field may be inactive." unless $result; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 28 | 43 | my $output = $self->render_element( $result ); | |||||||||||||||||||
| 29 | 43 | return $self->wrap_field( $result, $output ); | |||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 24 | 1; | |||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | __END__ | ||||||||||||||||||||