summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-05-16 16:46:08 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-05-16 16:46:08 +0000
commitc3917aa250b6b7ee4c5534224cf5f31380679c25 (patch)
treebd1473f9c1b4d14b7dcccb85d9b7667d09c1a3f2
parent930452aa6b93755003d4ce28143fccb4f23801b0 (diff)
Modify the module::event method to accept 2 additional parameters
instead of a variable list and then pass both of these parameters by reference to the event handlers. 2 parameters cover 100% of our existing event calls.
-rw-r--r--core/helpers/module.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/helpers/module.php b/core/helpers/module.php
index 2b1921de..7e483fb9 100644
--- a/core/helpers/module.php
+++ b/core/helpers/module.php
@@ -167,14 +167,15 @@ class module_Core {
* Run a specific event on all active modules.
* @param string $name the event name
* @param mixed $data data to pass to each event handler
+ * @param mixed $data2 data to pass to each event handler
*/
- static function event($name, &$data=null) {
+ static function event($name, &$data=null, &$data2=null) {
+ $args = empty($data2) ? array(&$data) : array(&$data, &$data2);
+ $function = str_replace(".", "_", $name);
+
foreach (self::installed() as $module) {
$class = "{$module->name}_event";
- $function = str_replace(".", "_", $name);
if (method_exists($class, $function)) {
- $args = func_get_args();
- array_shift($args);
call_user_func_array(array($class, $function), $args);
}
}