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