Debian Codegraph @

lib/HTML/FormHandler/Widget/Wrapper/SimpleInline.pm

raw
1 package HTML::FormHandler::Widget::Wrapper::SimpleInline;
2 # ABSTRACT: simple field wrapper
3 $HTML::FormHandler::Widget::Wrapper::SimpleInline::VERSION = '0.410002';
4 use Moose::Role;
5 use HTML::Entities qw( encode_entities );
6 use namespace::autoclean;
7
8 with 'HTML::FormHandler::Widget::Wrapper::Base';
9
10
11 sub wrap_field {
12 my ( $self, $result, $rendered_widget ) = @_;
13
14 return $rendered_widget if $self->has_flag('is_compound');
15
16 my $output = "\n";
17 my $tag = $self->wrapper_tag;
18 my $start_tag = $self->get_tag('wrapper_start');
19 if( defined $start_tag ) {
20 $output .= $start_tag;
21 }
22 else {
23 $output .= "<$tag" . process_attrs( $self->wrapper_attributes($result) ) . ">";
24 }
25
26 if ( $self->do_label && length( $self->label ) > 0 ) {
27 $output .= $self->do_render_label($result);
28 }
29
30 $output .= $rendered_widget;
31 $output .= qq{\n<span class="error_message">$_</span>}
32 for map { encode_entities($_) } $result->all_errors;
33
34 my $end_tag = $self->get_tag('wrapper_end');
35 $output .= defined $end_tag ? $end_tag : "</$tag>";
36
37 return "$output\n";
38 }
39
40 1;
41
42 __END__
43
44 =pod
45
46 =encoding UTF-8
47
48 =head1 NAME
49
50 HTML::FormHandler::Widget::Wrapper::SimpleInline - simple field wrapper
51
52 =head1 VERSION
53
54 version 0.410002
55
56 =head1 SYNOPSIS
57
58 This works like the Simple Wrapper, except it doesn't wrap Compound
59 fields.
60
61 =head1 AUTHOR
62
63 FormHandler Contributors - see HTML::FormHandler
64
65 =head1 COPYRIGHT AND LICENSE
66
67 This software is copyright (c) 2017 by Gerda Shank.
68
69 This is free software; you can redistribute it and/or modify it under
70 the same terms as the Perl 5 programming language system itself.
71
72 =cut