line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormHandler::Widget::Field::Checkbox; |
2
|
|
|
|
|
|
|
# ABSTRACT: HTML attributes field role |
3
|
|
|
|
|
|
|
$HTML::FormHandler::Widget::Field::Checkbox::VERSION = '0.40068'; |
4
|
24
|
|
|
24
|
|
17995
|
use Moose::Role; |
|
24
|
|
|
|
|
86
|
|
|
24
|
|
|
|
|
244
|
|
5
|
24
|
|
|
24
|
|
128410
|
use namespace::autoclean; |
|
24
|
|
|
|
|
68
|
|
|
24
|
|
|
|
|
254
|
|
6
|
24
|
|
|
24
|
|
1943
|
use HTML::FormHandler::Render::Util ('process_attrs'); |
|
24
|
|
|
|
|
67
|
|
|
24
|
|
|
|
|
221
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub render_element { |
10
|
44
|
|
|
44
|
0
|
122
|
my ( $self, $result ) = @_; |
11
|
44
|
|
33
|
|
|
140
|
$result ||= $self->result; |
12
|
|
|
|
|
|
|
|
13
|
44
|
|
|
|
|
1502
|
my $checkbox_value = $self->checkbox_value; |
14
|
44
|
|
|
|
|
1276
|
my $output = '<input type="checkbox" name="' |
15
|
|
|
|
|
|
|
. $self->html_name . '" id="' . $self->id . '" value="' |
16
|
|
|
|
|
|
|
. $self->html_filter($checkbox_value) . '"'; |
17
|
44
|
100
|
|
|
|
220
|
$output .= ' checked="checked"' |
18
|
|
|
|
|
|
|
if $result->fif eq $checkbox_value; |
19
|
44
|
|
|
|
|
268
|
$output .= process_attrs($self->element_attributes($result)); |
20
|
44
|
|
|
|
|
152
|
$output .= ' />'; |
21
|
44
|
|
|
|
|
143
|
return $output; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub render { |
25
|
43
|
|
|
43
|
0
|
146
|
my ( $self, $result ) = @_; |
26
|
43
|
|
66
|
|
|
796
|
$result ||= $self->result; |
27
|
43
|
50
|
|
|
|
152
|
die "No result for form field '" . $self->full_name . "'. Field may be inactive." unless $result; |
28
|
43
|
|
|
|
|
182
|
my $output = $self->render_element( $result ); |
29
|
43
|
|
|
|
|
280
|
return $self->wrap_field( $result, $output ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=encoding UTF-8 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
HTML::FormHandler::Widget::Field::Checkbox - HTML attributes field role |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 VERSION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
version 0.40068 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Checkbox field renderer |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 AUTHOR |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
FormHandler Contributors - see HTML::FormHandler |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Gerda Shank. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
61
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |