Catalyst-Controller-HTML-FormFu
view release on metacpan or search on metacpan
<Controller::HTML::FormFu>
<model_stash>
schema MySchema
</model_stash>
</Controller::HTML::FormFu>
context_stash
To allow your form validation packages, etc, access to the catalyst
context, a weakened reference of the context is copied into the form's
stash.
$form->stash->{context};
This setting allows you to change the key name used in the form stash.
Default value: context
languages_from_context
locate_comment = 1
[AutoPrereqs]
skip = ^blib
[Prereqs]
Catalyst::Runtime = 5.71001
HTML::FormFu = 2.06
HTML::FormFu::MultiForm = 1.02 ; previous versions fail to load
MooseX::Attribute::Chained = 0
Task::Weaken = 0 ; make sure Scalar::Util has weaken()
[Prereqs / TestRequires]
Catalyst::Action::RenderView = 0
Catalyst::Plugin::Session = 0
Catalyst::Plugin::Session::State::Cookie = 0
Catalyst::Plugin::Session::Store::File = 0
Catalyst::View::TT = 0
HTML::FormFu::MultiForm = 0
Template = 0
Test::WWW::Mechanize::Catalyst = 0
lib/Catalyst/Controller/HTML/FormFu.pm view on Meta::CPAN
use strict;
our $VERSION = '2.04'; # VERSION
our $AUTHORITY = 'cpan:NIGELM'; # AUTHORITY
use Moose;
use HTML::FormFu;
use Config::Any;
use Regexp::Assemble;
use Scalar::Util qw/ isweak weaken /;
use Carp qw/ croak /;
use namespace::autoclean;
# see https://rt.cpan.org/Ticket/Display.html?id=55780
BEGIN {
extends 'Catalyst::Controller';
}
with 'Catalyst::Component::InstancePerContext';
has _html_formfu_config => ( is => 'rw' );
sub build_per_context_instance {
my ( $self, $c ) = @_;
return $self unless ( ref $c );
$self->{c} = $c;
weaken( $self->{c} )
if !isweak( $self->{c} );
return $self;
}
sub BUILD { }
after BUILD => sub {
my ($self) = @_;
lib/Catalyst/Controller/HTML/FormFu.pm view on Meta::CPAN
{ $self->{c}->path_to( split( '\s*,\s*', $1 ) ) }eg
if /__path_to\(/;
s{__config\((.+?)\)__}
{ $self->{c}->config->{$1} }eg
if /__config\(/;
}
}
);
weaken( $self->{c} )
if !isweak( $self->{c} );
}
if ( $config->{languages_from_context} ) {
$form->languages( $self->{c}->languages );
}
if ( $config->{localize_from_context} ) {
$form->add_localize_object( $self->{c} );
}
lib/Catalyst/Controller/HTML/FormFu.pm view on Meta::CPAN
my $action = $self->{c}->{request}->base . $self->{c}->{request}->path;
$self->{c}->log->debug("FormFu - Setting default action by path: $action")
if $self->{c}->debug;
$form->action($action);
}
my $context_stash = $config->{context_stash};
$form->stash->{$context_stash} = $self->{c};
weaken( $form->stash->{$context_stash} );
my $model_stash = $config->{model_stash};
for my $model ( keys %$model_stash ) {
$form->stash->{$model} = $self->{c}->model( $model_stash->{$model} );
}
return;
}
lib/Catalyst/Controller/HTML/FormFu.pm view on Meta::CPAN
<Controller::HTML::FormFu>
<model_stash>
schema MySchema
</model_stash>
</Controller::HTML::FormFu>
=head2 context_stash
To allow your form validation packages, etc, access to the catalyst context, a
weakened reference of the context is copied into the form's stash.
$form->stash->{context};
This setting allows you to change the key name used in the form stash.
Default value: C<context>
=head2 languages_from_context
If you're using a L10N / I18N plugin such as L<Catalyst::Plugin::I18N> which
( run in 0.389 second using v1.01-cache-2.11-cpan-65fba6d93b7 )