]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Controller-Basisklasse: bei run_before/after-Hooks den Namen der Action mitgeben
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 31 Aug 2012 11:41:18 +0000 (13:41 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 31 Aug 2012 11:41:18 +0000 (13:41 +0200)
SL/Controller/Base.pm

index f99b1e722b0e5174e0ba469a8ddec3816a2e157b..acf5df5931af61e44d6127e37009557e905bdca6 100644 (file)
@@ -160,10 +160,10 @@ sub _run_hooks {
          || ($hook->{except} &&  $hook->{except}->{$action});
 
     if (ref($hook->{code}) eq 'CODE') {
          || ($hook->{except} &&  $hook->{except}->{$action});
 
     if (ref($hook->{code}) eq 'CODE') {
-      $hook->{code}->($self);
+      $hook->{code}->($self, $action);
     } else {
       my $sub = $hook->{code};
     } 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.
 
 
 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<before> hooks) / was called (for C<after>
+hooks).
+
 The return value of the hooks is discarded.
 
 Hooks can be defined to run for all actions, for only specific actions
 The return value of the hooks is discarded.
 
 Hooks can be defined to run for all actions, for only specific actions