aboutsummaryrefslogtreecommitdiff
path: root/documentation/examples/events/all.php
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/examples/events/all.php')
-rw-r--r--documentation/examples/events/all.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/documentation/examples/events/all.php b/documentation/examples/events/all.php
new file mode 100644
index 000000000..63959a9d2
--- /dev/null
+++ b/documentation/examples/events/all.php
@@ -0,0 +1,24 @@
+<?php
+
+register_elgg_event_handler('all', 'object', 'example_event_handler');
+
+// This function will be called for any event of type 'object'
+function example_event_handler($event, $type, $params) {
+ // check what sort of object is passed
+ if ($params instanceof ElggObject) {
+ $subtype = $params->getSubtype();
+
+ switch($subtype) {
+ case 'blog':
+ case 'thewire':
+ case 'pages':
+ return false;
+ default:
+ return true;
+ }
+
+ }
+
+ return true;
+}
+