| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Form::Factory::Interface::HTML::Widget::Element; |
|
2
|
|
|
|
|
|
|
$Form::Factory::Interface::HTML::Widget::Element::VERSION = '0.022'; |
|
3
|
1
|
|
|
1
|
|
486
|
use Moose; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
with qw( Form::Factory::Interface::HTML::Widget ); |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: HTML interface widget helper |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has tag_name => ( |
|
11
|
|
|
|
|
|
|
is => 'ro', |
|
12
|
|
|
|
|
|
|
isa => 'Str', |
|
13
|
|
|
|
|
|
|
required => 1, |
|
14
|
|
|
|
|
|
|
); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has id => ( |
|
17
|
|
|
|
|
|
|
is => 'ro', |
|
18
|
|
|
|
|
|
|
isa => 'Str', |
|
19
|
|
|
|
|
|
|
predicate => 'has_id', |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has classes => ( |
|
23
|
|
|
|
|
|
|
is => 'ro', |
|
24
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
|
25
|
|
|
|
|
|
|
required => 1, |
|
26
|
|
|
|
|
|
|
default => sub { [] }, |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has attributes => ( |
|
30
|
|
|
|
|
|
|
is => 'ro', |
|
31
|
|
|
|
|
|
|
isa => 'HashRef[Str]', |
|
32
|
|
|
|
|
|
|
required => 1, |
|
33
|
|
|
|
|
|
|
default => sub { {} }, |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has content => ( |
|
37
|
|
|
|
|
|
|
is => 'ro', |
|
38
|
|
|
|
|
|
|
isa => 'Str', |
|
39
|
|
|
|
|
|
|
predicate => '_has_content', |
|
40
|
|
|
|
|
|
|
); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub has_content { |
|
43
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
|
44
|
1
|
|
|
|
|
55
|
return $self->_has_content; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub render_control { |
|
48
|
6
|
|
|
6
|
0
|
16
|
my ($self, %options) = @_; |
|
49
|
|
|
|
|
|
|
|
|
50
|
6
|
|
|
|
|
203
|
my $html = '<' . $self->tag_name; |
|
51
|
6
|
|
|
|
|
34
|
$html .= $self->render_id(%options); |
|
52
|
6
|
|
|
|
|
27
|
$html .= $self->render_class(%options); |
|
53
|
6
|
|
|
|
|
25
|
$html .= $self->render_attributes(%options); |
|
54
|
|
|
|
|
|
|
|
|
55
|
6
|
100
|
|
|
|
33
|
if ($self->has_content) { |
|
56
|
5
|
|
|
|
|
10
|
$html .= '>'; |
|
57
|
5
|
|
|
|
|
17
|
$html .= $self->render_content(%options); |
|
58
|
5
|
|
|
|
|
167
|
$html .= '</' . $self->tag_name . '>'; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
else { |
|
62
|
1
|
|
|
|
|
3
|
$html .= '/>'; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
6
|
|
|
|
|
236
|
return $html; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub render_content { |
|
69
|
5
|
|
|
5
|
0
|
6
|
my $self = shift; |
|
70
|
5
|
|
|
|
|
202
|
my $content = $self->content; |
|
71
|
5
|
|
50
|
|
|
174
|
return $self->content || ''; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub render_id { |
|
75
|
6
|
|
|
6
|
0
|
6
|
my $self = shift; |
|
76
|
6
|
100
|
|
|
|
208
|
return '' unless $self->has_id; |
|
77
|
1
|
|
|
|
|
40
|
return ' id="' . $self->id . '"'; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub render_class { |
|
81
|
6
|
|
|
6
|
0
|
7
|
my $self = shift; |
|
82
|
|
|
|
|
|
|
|
|
83
|
6
|
|
|
|
|
7
|
my @classes = ('form', @{ $self->classes }); |
|
|
6
|
|
|
|
|
195
|
|
|
84
|
6
|
|
|
|
|
25
|
return ' class="' . join(' ', @classes) . '"'; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub render_attributes { |
|
88
|
6
|
|
|
6
|
0
|
11
|
my $self = shift; |
|
89
|
6
|
|
|
|
|
6
|
my @attributes; |
|
90
|
|
|
|
|
|
|
|
|
91
|
6
|
|
|
|
|
211
|
my %attributes = ( |
|
92
|
6
|
|
|
|
|
22
|
%{ $self->attributes }, |
|
93
|
6
|
|
|
|
|
9
|
%{ $self->more_attributes }, |
|
94
|
|
|
|
|
|
|
); |
|
95
|
|
|
|
|
|
|
|
|
96
|
6
|
|
|
|
|
37
|
while (my ($name, $value) = each %attributes) { |
|
97
|
3
|
|
|
|
|
15
|
push @attributes, $name . '="' . $value . '"'; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
6
|
|
|
|
|
23
|
return join ' ', @attributes; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
5
|
|
|
5
|
0
|
47
|
sub more_attributes { {} } |
|
104
|
|
|
|
|
|
|
|
|
105
|
130
|
|
|
130
|
0
|
912
|
sub consume_control { } |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
__END__ |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=pod |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=encoding UTF-8 |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 NAME |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Form::Factory::Interface::HTML::Widget::Element - HTML interface widget helper |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 VERSION |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
version 0.022 |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Move along. Nothing to see here. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=for Pod::Coverage .* |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHOR |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Andrew Sterling Hanenkamp <hanenkamp@cpan.org> |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Qubling Software LLC. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
139
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |