diff options
author | Michał Gaździk <m.gazdzik@clearcode.cc> | 2014-07-29 14:25:59 +0400 |
---|---|---|
committer | Michał Gaździk <m.gazdzik@clearcode.cc> | 2014-07-29 14:25:59 +0400 |
commit | 5c33d0a6accd42bf1739bb6040596ffcba4b5bdc (patch) | |
tree | e7641606a2954d7e85948d0eb33ec837bc22f574 /core/EventDispatcher.php | |
parent | 84b0c351265f9d961a39d694e6cc6db21f4316e4 (diff) |
fixed broken EventDispatcher mechanism for sorting callbacks order
Diffstat (limited to 'core/EventDispatcher.php')
-rw-r--r-- | core/EventDispatcher.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/EventDispatcher.php b/core/EventDispatcher.php index 42d35c6b0e..b902bdef2c 100644 --- a/core/EventDispatcher.php +++ b/core/EventDispatcher.php @@ -92,6 +92,8 @@ class EventDispatcher extends Singleton } } + // sort callbacks by their importance + ksort($callbacks); // execute callbacks in order foreach ($callbacks as $callbackGroup) { foreach ($callbackGroup as $callback) { @@ -171,10 +173,9 @@ class EventDispatcher extends Singleton if (!empty($hookInfo['before'])) { $callbackGroup = self::EVENT_CALLBACK_GROUP_FIRST; } else if (!empty($hookInfo['after'])) { - $callbackGroup = self::EVENT_CALLBACK_GROUP_SECOND; - } else { $callbackGroup = self::EVENT_CALLBACK_GROUP_THIRD; - } + } else { + $callbackGroup = self::EVENT_CALLBACK_GROUP_SECOND; } } else { $pluginFunction = $hookInfo; $callbackGroup = self::EVENT_CALLBACK_GROUP_SECOND; |