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