line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
793
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
178
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::FormFu::Element::ContentButton; |
4
|
|
|
|
|
|
|
$HTML::FormFu::Element::ContentButton::VERSION = '2.07'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Button form field containing markup |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
100
|
use Moose; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
21
|
|
8
|
3
|
|
|
3
|
|
29394
|
use MooseX::Attribute::Chained; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
163
|
|
9
|
|
|
|
|
|
|
extends "HTML::FormFu::Element"; |
10
|
|
|
|
|
|
|
with 'HTML::FormFu::Role::Element::Field', |
11
|
|
|
|
|
|
|
'HTML::FormFu::Role::Element::SingleValueField'; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
3
|
|
20
|
use HTML::FormFu::Util qw( xml_escape process_attrs ); |
|
3
|
|
|
|
|
96
|
|
|
3
|
|
|
|
|
1110
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
__PACKAGE__->mk_output_accessors(qw( content )); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has field_type => ( |
18
|
|
|
|
|
|
|
is => 'rw', |
19
|
|
|
|
|
|
|
default => 'button', |
20
|
|
|
|
|
|
|
lazy => 1, |
21
|
|
|
|
|
|
|
traits => ['Chained'], |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
after BUILD => sub { |
25
|
|
|
|
|
|
|
my ( $self, $args ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$self->layout_field_filename('field_layout_contentbutton_field'); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return; |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub render_data_non_recursive { |
33
|
|
|
|
|
|
|
my ( $self, $args ) = @_; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $render = $self->SUPER::render_data_non_recursive( |
36
|
|
|
|
|
|
|
{ field_type => $self->field_type, |
37
|
|
|
|
|
|
|
content => xml_escape( $self->content ), |
38
|
|
|
|
|
|
|
$args ? %$args : (), |
39
|
|
|
|
|
|
|
} ); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return $render; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _string_field { |
45
|
7
|
|
|
7
|
|
16
|
my ( $self, $render ) = @_; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# content_button template |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $html .= sprintf qq{<button name="%s" type="%s"}, |
50
|
|
|
|
|
|
|
$render->{nested_name}, |
51
|
|
|
|
|
|
|
$render->{field_type}, |
52
|
7
|
|
|
|
|
34
|
; |
53
|
|
|
|
|
|
|
|
54
|
7
|
100
|
|
|
|
19
|
if ( defined $render->{value} ) { |
55
|
2
|
|
|
|
|
9
|
$html .= sprintf qq{ value="%s"}, $render->{value}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
$html .= sprintf "%s>%s</button>", |
59
|
|
|
|
|
|
|
process_attrs( $render->{attributes} ), |
60
|
7
|
100
|
|
|
|
24
|
( defined $render->{content} ? $render->{content} : '' ), |
61
|
|
|
|
|
|
|
; |
62
|
|
|
|
|
|
|
|
63
|
7
|
|
|
|
|
24
|
return $html; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=pod |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=encoding UTF-8 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 NAME |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
HTML::FormFu::Element::ContentButton - Button form field containing markup |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 VERSION |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
version 2.07 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 SYNOPSIS |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
--- |
87
|
|
|
|
|
|
|
elements: |
88
|
|
|
|
|
|
|
type: ContentButton |
89
|
|
|
|
|
|
|
name: foo |
90
|
|
|
|
|
|
|
content: '<img href="/foo.png" />' |
91
|
|
|
|
|
|
|
field_type: Submit |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 DESCRIPTION |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
content_button form field, rendered using provided markup. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 METHODS |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 content |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 field_type |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 SEE ALSO |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Is a sub-class of, and inherits methods from |
106
|
|
|
|
|
|
|
L<HTML::FormFu::Role::Element::Field>, |
107
|
|
|
|
|
|
|
L<HTML::FormFu::Element> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
L<HTML::FormFu> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 AUTHOR |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Carl Franks, C<cfranks@cpan.org> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 LICENSE |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
118
|
|
|
|
|
|
|
the same terms as Perl itself. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 AUTHOR |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Carl Franks <cpan@fireartist.com> |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Carl Franks. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
129
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |