line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
754
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
266
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::FormFu::Element::Label; |
4
|
|
|
|
|
|
|
$HTML::FormFu::Element::Label::VERSION = '2.07'; |
5
|
|
|
|
|
|
|
# ABSTRACT: field for displaying only |
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
23
|
use Moose; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
29
|
|
8
|
4
|
|
|
4
|
|
26884
|
use MooseX::Attribute::Chained; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
215
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends "HTML::FormFu::Element"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'HTML::FormFu::Role::Element::Field', |
13
|
|
|
|
|
|
|
'HTML::FormFu::Role::Element::SingleValueField', |
14
|
|
|
|
|
|
|
'HTML::FormFu::Role::Element::Coercible'; |
15
|
|
|
|
|
|
|
|
16
|
4
|
|
|
4
|
|
26
|
use HTML::FormFu::Util qw( process_attrs ); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
315
|
|
17
|
4
|
|
|
4
|
|
26
|
use List::Util 1.33 qw( none ); |
|
4
|
|
|
|
|
102
|
|
|
4
|
|
|
|
|
1921
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has field_type => ( is => 'rw', traits => ['Chained'] ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has tag => ( |
22
|
|
|
|
|
|
|
is => 'rw', |
23
|
|
|
|
|
|
|
default => 'span', |
24
|
|
|
|
|
|
|
lazy => 1, |
25
|
|
|
|
|
|
|
traits => ['Chained'], |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
after BUILD => sub { |
29
|
|
|
|
|
|
|
my $self = shift; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$self->layout_field_filename('field_layout_label_field'); |
32
|
|
|
|
|
|
|
$self->non_param(1); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#$self->field_type('label'); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$self->model_config->{read_only} = 1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
return; |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _string_field { |
42
|
5
|
|
|
5
|
|
13
|
my ( $self, $render ) = @_; |
43
|
|
|
|
|
|
|
|
44
|
5
|
|
|
|
|
148
|
my $html .= "<" . $self->tag; |
45
|
|
|
|
|
|
|
|
46
|
5
|
|
50
|
|
|
25
|
$html .= sprintf "%s", process_attrs( $render->{attributes} || {} ); |
47
|
|
|
|
|
|
|
|
48
|
5
|
50
|
|
|
|
14
|
if ( defined $render->{nested_name} ) { |
49
|
5
|
|
|
|
|
19
|
$html .= sprintf qq{ name="%s"}, $render->{nested_name}; |
50
|
|
|
|
|
|
|
} |
51
|
5
|
|
|
|
|
9
|
$html .= ">"; |
52
|
5
|
100
|
|
|
|
13
|
if ( defined $render->{value} ) { |
53
|
4
|
|
|
|
|
11
|
$html .= sprintf qq{%s}, $render->{value}; |
54
|
|
|
|
|
|
|
} |
55
|
5
|
|
|
|
|
133
|
$html .= "</" . $self->tag . ">"; |
56
|
|
|
|
|
|
|
|
57
|
5
|
|
|
|
|
17
|
return $html; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub process_input { |
61
|
5
|
|
|
5
|
|
14
|
my ( $self, $input ) = @_; |
62
|
|
|
|
|
|
|
|
63
|
5
|
|
|
|
|
17
|
my $form = $self->form; |
64
|
5
|
|
|
|
|
20
|
my $name = $self->nested_name; |
65
|
|
|
|
|
|
|
|
66
|
5
|
100
|
66
|
|
|
114
|
if ( $form->submitted |
67
|
|
|
|
|
|
|
&& $form->nested_hash_key_exists( $input, $name ) ) |
68
|
|
|
|
|
|
|
{ |
69
|
2
|
|
|
|
|
4
|
my @fields = @{ $form->get_fields( { nested_name => $name } ) }; |
|
2
|
|
|
|
|
11
|
|
70
|
|
|
|
|
|
|
|
71
|
2
|
50
|
|
2
|
|
13
|
if ( none { $_ == $self } @fields ) { |
|
2
|
|
|
|
|
12
|
|
72
|
0
|
|
|
|
|
0
|
$form->delete_nested_hash_key( $input, $name ); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
5
|
|
|
|
|
20
|
return; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub render_data_non_recursive { |
80
|
|
|
|
|
|
|
my ( $self, $args ) = @_; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $render = $self->SUPER::render_data_non_recursive( |
83
|
|
|
|
|
|
|
{ tag => $self->tag, |
84
|
|
|
|
|
|
|
$args ? %$args : (), |
85
|
|
|
|
|
|
|
} ); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
return $render; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=pod |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=encoding UTF-8 |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 NAME |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
HTML::FormFu::Element::Label - field for displaying only |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 VERSION |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
version 2.07 |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 DESCRIPTION |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This element displays a value. This is useful if you use a model like |
111
|
|
|
|
|
|
|
L<HTML::FormFu::Model::DBIC> and want to display a value from the database. |
112
|
|
|
|
|
|
|
The value of this field cannot be set by the client. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
See L<HTML::FormFu::Model::DBIC/"Set a field read only"> for more information |
115
|
|
|
|
|
|
|
on read only fields. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 METHODS |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 tag |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Set the tag for this element. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 SEE ALSO |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Is a sub-class of, and inherits methods from |
126
|
|
|
|
|
|
|
L<HTML::FormFu::Role::Element::Field>, L<HTML::FormFu::Element> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
L<HTML::FormFu> |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHOR |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Moritz Onken, C<< onken at houseofdesign.de >> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 LICENSE |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
137
|
|
|
|
|
|
|
the same terms as Perl itself. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 AUTHOR |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Carl Franks <cpan@fireartist.com> |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Carl Franks. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
148
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |