Debian Codegraph @

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

raw
1 package HTML::FormHandler::Widget::Wrapper::Fieldset;
2 # ABSTRACT: fieldset field wrapper
3 $HTML::FormHandler::Widget::Wrapper::Fieldset::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 use HTML::FormHandler::Render::Util ('process_attrs');
10
11
12 sub wrap_field {
13 my ( $self, $result, $rendered_widget ) = @_;
14
15 my $wattrs = process_attrs($self->wrapper_attributes);
16 my $output = qq{\n<fieldset$wattrs>};
17 $output .= qq{\n<legend>} . $self->loc_label . '</legend>';
18
19 $output .= "\n$rendered_widget";
20
21 $output .= qq{\n<span class="error_message">$_</span>}
22 for map { encode_entities($_) } $result->all_errors;
23 $output .= "\n</fieldset>";
24
25 return $output;
26 }
27
28 1;
29
30 __END__
31
32 =pod
33
34 =encoding UTF-8
35
36 =head1 NAME
37
38 HTML::FormHandler::Widget::Wrapper::Fieldset - fieldset field wrapper
39
40 =head1 VERSION
41
42 version 0.410002
43
44 =head1 SYNOPSIS
45
46 Wraps a single field in a fieldset.
47
48 =head1 NAME
49
50 HTML::FormHandler::Widget::Wrapper::Fieldset - fieldset field wrapper
51
52 =head1 AUTHOR
53
54 FormHandler Contributors - see HTML::FormHandler
55
56 =head1 COPYRIGHT AND LICENSE
57
58 This software is copyright (c) 2017 by Gerda Shank.
59
60 This is free software; you can redistribute it and/or modify it under
61 the same terms as the Perl 5 programming language system itself.
62
63 =cut