/lib/HTML/FormHandler/Widget/Wrapper/SimpleInline.pm
Perl | 45 lines | 40 code | 4 blank | 1 comment | 0 complexity | 76846c7f04a4d1f6910ba09b46e0fb0a MD5 | raw file
1package HTML::FormHandler::Widget::Wrapper::SimpleInline; 2# ABSTRACT: simple field wrapper 3 4use Moose::Role; 5use namespace::autoclean; 6 7with 'HTML::FormHandler::Widget::Wrapper::Base'; 8 9=head1 SYNOPSIS 10 11This works like the Simple Wrapper, except it doesn't wrap Compound 12fields. 13 14=cut 15 16sub wrap_field { 17 my ( $self, $result, $rendered_widget ) = @_; 18 19 return $rendered_widget if $self->has_flag('is_compound'); 20 21 my $output = "\n"; 22 my $tag = $self->wrapper_tag; 23 my $start_tag = $self->get_tag('wrapper_start'); 24 if( defined $start_tag ) { 25 $output .= $start_tag; 26 } 27 else { 28 $output .= "<$tag" . process_attrs( $self->wrapper_attributes($result) ) . ">"; 29 } 30 31 if ( $self->do_label && length( $self->label ) > 0 ) { 32 $output .= $self->do_render_label($result); 33 } 34 35 $output .= $rendered_widget; 36 $output .= qq{\n<span class="error_message">$_</span>} 37 for $result->all_errors; 38 39 my $end_tag = $self->get_tag('wrapper_end'); 40 $output .= defined $end_tag ? $end_tag : "</$tag>"; 41 42 return "$output\n"; 43} 44 451;