Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0152cc2e

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID 0152cc2e4e1e451cb51d4d3fd8a0e450eff5efcb
  • Vorgänger 7399e9f0
  • Nachfolger 26a5973f

GetModels: Funktion zum Setzen zusätzlicher URL-Parameter

Unterschiede anzeigen:

SL/Controller/Helper/GetModels.pm
use Rose::Object::MakeMethods::Generic (
scalar => [ qw(controller model query with_objects filtered sorted paginated finalized final_params) ],
'scalar --get_set_init' => [ qw(handlers source) ],
'scalar --get_set_init' => [ qw(handlers source additional_url_params) ],
array => [ qw(plugins) ],
);
......
return %{ $self->final_params } if $self->finalized;
$self->register_handlers(callback => sub { shift; (@_, %{ $self->additional_url_params }) }) if %{ $self->additional_url_params };
push @{ $params{query} ||= [] }, @{ $self->query || [] };
push @{ $params{with_objects} ||= [] }, @{ $self->with_objects || [] };
......
map { push @{ $handlers->{$_} }, $additional_handlers{$_} if $additional_handlers{$_} } keys %$handlers;
}
sub add_additional_url_params {
my ($self, %params) = @_;
$self->additional_url_params({ %{ $self->additional_url_params }, %params });
return $self;
}
sub get_models_url_params {
my ($self, $sub_name_or_code) = @_;
......
$::form
}
sub init_additional_url_params { +{} }
1;
__END__
......
The value returned by C<SUB> must be either a single hash
reference or a hash of key/value pairs to add to the URL.
=item add_additional_url_params C<%params>
Sets additional parameters that will be added to each URL generated by
this model (e.g. for pagination/sorting). This is just sugar for a
proper call to L<get_models_url_params> with an anonymous sub adding
those parameters.
=item get_callback
Returns a URL suitable for use as a callback parameter. It maps to the

Auch abrufbar als: Unified diff