From: Moritz Bunkus Date: Fri, 31 Aug 2012 11:41:18 +0000 (+0200) Subject: Controller-Basisklasse: bei run_before/after-Hooks den Namen der Action mitgeben X-Git-Tag: release-3.0.0beta1~261 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=24a9617088c80727bd4b348c8592224e447b9b92;p=kivitendo-erp.git Controller-Basisklasse: bei run_before/after-Hooks den Namen der Action mitgeben --- diff --git a/SL/Controller/Base.pm b/SL/Controller/Base.pm index f99b1e722..acf5df593 100644 --- a/SL/Controller/Base.pm +++ b/SL/Controller/Base.pm @@ -160,10 +160,10 @@ sub _run_hooks { || ($hook->{except} && $hook->{except}->{$action}); if (ref($hook->{code}) eq 'CODE') { - $hook->{code}->($self); + $hook->{code}->($self, $action); } else { my $sub = $hook->{code}; - $self->$sub; + $self->$sub($action); } } } @@ -328,6 +328,10 @@ hooks themselves are run as instance methods. Hooks are run in the order they're added. +The hooks receive a single parameter: the name of the action that is +about to be called (for C hooks) / was called (for C +hooks). + The return value of the hooks is discarded. Hooks can be defined to run for all actions, for only specific actions