aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/lib/hooks.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/js/lib/hooks.js b/js/lib/hooks.js
index eeaffb846..ab3a8a224 100644
--- a/js/lib/hooks.js
+++ b/js/lib/hooks.js
@@ -77,11 +77,23 @@ elgg.trigger_hook = function(name, type, params, value) {
elgg.provide(name + '.all', hooks);
elgg.provide('all.all', hooks);
- [ hooks[name][type],
- hooks['all'][type],
- hooks[name]['all'],
- hooks['all']['all']
- ].every(function(handlers) {
+ var hooksList = [];
+
+ if (name != 'all' && type != 'all') {
+ hooksList.push(hooks[name][type]);
+ }
+
+ if (type != 'all') {
+ hooksList.push(hooks['all'][type]);
+ }
+
+ if (name != 'all') {
+ hooksList.push(hooks[name]['all']);
+ }
+
+ hooksList.push(hooks['all']['all']);
+
+ hooksList.every(function(handlers) {
if (handlers instanceof elgg.ElggPriorityList) {
handlers.forEach(callHookHandler);
}