Skip to content
Snippets Groups Projects
Commit bb852592 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Restore broken feature. One hook = One call of function per module.

parent c51b964b
No related branches found
No related tags found
No related merge requests found
...@@ -157,8 +157,6 @@ class HookManager ...@@ -157,8 +157,6 @@ class HookManager
{ {
if (! empty($modules)) if (! empty($modules))
{ {
$modulealreadyexecuted[$context]=array(); // Filter by context
foreach($modules as $module => $actionclassinstance) foreach($modules as $module => $actionclassinstance)
{ {
//print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction." result=".$result."<br>\n"; //print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction." result=".$result."<br>\n";
...@@ -167,8 +165,8 @@ class HookManager ...@@ -167,8 +165,8 @@ class HookManager
// jump to next class if method does not exists // jump to next class if method does not exists
if (! method_exists($actionclassinstance,$method)) continue; if (! method_exists($actionclassinstance,$method)) continue;
// test to avoid to run twice a hook, when a module implements several active contexts // test to avoid to run twice a hook, when a module implements several active contexts
if (in_array($module,$modulealreadyexecuted[$context])) continue; if (in_array($module,$modulealreadyexecuted)) continue;
$modulealreadyexecuted[$context][$module]=$module; // Use the $currentcontext in method for avoid to run twice $modulealreadyexecuted[$module]=$module; // Use the $currentcontext in method for avoid to run twice
// Add current context for avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return; // Add current context for avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return;
$parameters['currentcontext'] = $context; $parameters['currentcontext'] = $context;
// Hooks that must return int (hooks with type 'addreplace') // Hooks that must return int (hooks with type 'addreplace')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment