Form::Factory::Interface::HTML::Widget::Div - HTML interface widget helper


Form-Factory documentation Contained in the Form-Factory distribution.

Index


Code Index:

NAME

Top

Form::Factory::Interface::HTML::Widget::Div - HTML interface widget helper

VERSION

Top

version 0.020

DESCRIPTION

Top

Move along. Nothing to see here.

AUTHOR

Top

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

Top


Form-Factory documentation Contained in the Form-Factory distribution.
package Form::Factory::Interface::HTML::Widget::Div;
BEGIN {
  $Form::Factory::Interface::HTML::Widget::Div::VERSION = '0.020';
}
use Moose;

extends qw( Form::Factory::Interface::HTML::Widget::Element );

has '+tag_name' => (
    default   => 'div',
);

has widgets => (
    is        => 'ro',
    isa       => 'ArrayRef',
    required  => 1,
    default   => sub { [] },
);

sub has_content { 1 }

sub render_widgets {
    my $self = shift;
    my $content = '';
    for my $widget (@{ $self->widgets }) {
        $content .= $widget->render;
    }
    return $content;
}

override render => sub {
    my $self = shift;
    return super() . $self->render_widgets;
};

sub consume_control {
    my $self = shift;
    my %args_accumulator;

    %args_accumulator = (%args_accumulator, %{ $_->consume(@_) || {} }) 
        for @{ $self->widgets };

    return \%args_accumulator;
}

1;