Use concrete5's events when you wish to include extra functionality based on things concrete5 already does, without hacking away at the core.


A certain page type has some extra information associated with it. When you delete a page of this type, you want that extra information, in an extra database table, to go away as well. You can't easily modify the Page::delete() method in the Concrete\Core\Page\Page class without harming easy upgradeability. Instead, you really need to hook into concrete5's delete page routine, and run your own code, and be done with it.

Another example: let's say you're using your website's members in a third party authentication system, and any time someone adds a user to your concrete5 website, you want to run some custom code in that third party system (through an API you've created). Rather than finding all the places in code where a user account might be added, and hacking those places, you really need a centralized way to hook into an "Add User" event, wherever and however it occurs.

You can get this kind of functionality by hooking your own custom code into concrete5's Events System. Read on for more information.

Loading Conversation