« Catalyst/Controller/HTML/FormFu/Action/FormMethod.pm
↑ Summary
Catalyst/Controller/HTML/FormFu/Action/MultiFormMethod.pm »
| 1 | package Catalyst::Controller::HTML::FormFu::Action::MultiForm; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | |||
| 5 | our $VERSION = '2.04'; # VERSION | ||
| 6 | our $AUTHORITY = 'cpan:NIGELM'; # AUTHORITY | ||
| 7 | |||
| 8 | use Moose; | ||
| 9 | use Config::Any; | ||
| 10 | use namespace::autoclean; | ||
| 11 | |||
| 12 | extends 'Catalyst::Controller::HTML::FormFu::ActionBase::Form'; | ||
| 13 | |||
| 14 | sub execute { | ||
| 15 | my $self = shift; | ||
| 16 | my ( $controller, $c ) = @_; | ||
| 17 | |||
| 18 | if ( $self->reverse =~ $self->_form_action_regex ) { | ||
| 19 | |||
| 20 | # don't load form again | ||
| 21 | return $self->next::method(@_); | ||
| 22 | } | ||
| 23 | |||
| 24 | my $config = $controller->_html_formfu_config; | ||
| 25 | |||
| 26 | return $self->next::method(@_) | ||
| 27 | unless exists $self->attributes->{ActionClass} | ||
| 28 | && $self->attributes->{ActionClass}[0] eq $config->{multiform_action}; | ||
| 29 | |||
| 30 | my $multi = $controller->_multiform; | ||
| 31 | |||
| 32 | $multi->process; | ||
| 33 | |||
| 34 | $c->stash->{ $config->{multiform_stash} } = $multi; | ||
| 35 | $c->stash->{ $config->{form_stash} } = $multi->current_form; | ||
| 36 | |||
| 37 | $self->next::method(@_); | ||
| 38 | } | ||
| 39 | |||
| 40 | 1; | ||
| 41 | |||
| 42 | __END__ |