Deutschland United States United Kingdom
ContentLion - Open Source CMS

Event system

You can extend ContentLion with the event system. On serval places in ContentLion those events where thrown. For example:

  1. A user logged in
  2. A page was saved
  3. A menu was deleted

To react after a event, you have to register an event in your activate.php. We include a php file, you can give us with the addHandler method.

EventManager::addHandler("system/plugins/hello-world/page-saved.php",
"page_saved");

Every time the event page_saved was raised, we will execute the file system/plugins/hello-world/page-saved.php.

Inside the file, you can use all functions of ContentLion. In this example we know, that a page was saved, but which page was it? You can access the properties of the events in the $args array. They are different for each Event

Raise own events

It would be nice, if you raise events on important places of you plugin. So other plugins can extend your plugin. Look here:

<?PHP
	$args               = array();
	$args['time'] = time();
	EventManager::RaiseEvent("myevent",$args);
?>

Now other plugins can react to myevent. It's important to take care of the namespaces, to avoid conflicts.