Elgg  Version 2.3
all.php
Go to the documentation of this file.
1 <?php
9 elgg_register_event_handler('all', 'object', 'example_event_handler');
10 
11 // This function will be called for any event of type 'object'
12 function example_event_handler($event, $type, $object) {
13  // check what sort of object is passed
14  if ($object instanceof ElggObject) {
15  $subtype = $object->getSubtype();
16 
17  switch ($subtype) {
18  case 'blog':
19  case 'thewire':
20  case 'pages':
21  // prevent these object subtypes from being saved or changed
22  return false;
23  default:
24  return true;
25  }
26 
27  }
28 
29  return true;
30 }
$object
These two snippets demonstrates triggering an event and how to register for that event.
Definition: trigger.php:7
$subtype
Definition: delete.php:28
elgg_register_event_handler($event, $object_type, $callback, $priority=500)
Definition: elgglib.php:550
example_event_handler($event, $type, $object)
Definition: all.php:12
if(!$display_name) $type
Definition: delete.php:27