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.40067'; |
4
|
24
|
|
|
24
|
|
16387
|
use Moose::Role; |
|
24
|
|
|
|
|
41
|
|
|
24
|
|
|
|
|
217
|
|
5
|
24
|
|
|
24
|
|
90877
|
use namespace::autoclean; |
|
24
|
|
|
|
|
38
|
|
|
24
|
|
|
|
|
221
|
|
6
|
24
|
|
|
24
|
|
1624
|
use HTML::FormHandler::Render::Util ('process_attrs'); |
|
24
|
|
|
|
|
40
|
|
|
24
|
|
|
|
|
200
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub render_element { |
10
|
44
|
|
|
44
|
0
|
64
|
my ( $self, $result ) = @_; |
11
|
44
|
|
33
|
|
|
99
|
$result ||= $self->result; |
12
|
|
|
|
|
|
|
|
13
|
44
|
|
|
|
|
1427
|
my $checkbox_value = $self->checkbox_value; |
14
|
44
|
|
|
|
|
1185
|
my $output = '<input type="checkbox" name="' |
15
|
|
|
|
|
|
|
. $self->html_name . '" id="' . $self->id . '" value="' |
16
|
|
|
|
|
|
|
. $self->html_filter($checkbox_value) . '"'; |
17
|
44
|
100
|
|
|
|
172
|
$output .= ' checked="checked"' |
18
|
|
|
|
|
|
|
if $result->fif eq $checkbox_value; |
19
|
44
|
|
|
|
|
190
|
$output .= process_attrs($self->element_attributes($result)); |
20
|
44
|
|
|
|
|
111
|
$output .= ' />'; |
21
|
44
|
|
|
|
|
100
|
return $output; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub render { |
25
|
43
|
|
|
43
|
0
|
70
|
my ( $self, $result ) = @_; |
26
|
43
|
|
66
|
|
|
684
|
$result ||= $self->result; |
27
|
43
|
50
|
|
|
|
103
|
die "No result for form field '" . $self->full_name . "'. Field may be inactive." unless $result; |
28
|
43
|
|
|
|
|
152
|
my $output = $self->render_element( $result ); |
29
|
43
|
|
|
|
|
159
|
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.40067 |
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) 2016 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 |