Packaged Events... am I doing this right?
Permalink
Ok... So I have a package that adds a new page type and I want to email a user when a page of this type is added, updated or deleted.
After reading through the available documentation I thought I found the way to do this... i.e:
Add......to my package's controller.php file and add......to the page type controller.php file.
However, this doesn't seem to work. What am I doing wrong?
After reading through the available documentation I thought I found the way to do this... i.e:
Add...
public function on_start() { define('ENABLE_APPLICATION_EVENTS', TRUE); Events::extendPageType('new_page_type', 'on_page_add'); Events::extendPageType('new_page_type', 'on_page_update'); Events::extendPageType('new_page_type', 'on_page_delete'); }
public function on_page_add() { // Code here... } public function on_page_update() { // Code here... } public function on_page_delete() { // Code here... }
However, this doesn't seem to work. What am I doing wrong?
also, you don't need the define if your doing it in a package i believe its only if you have a site_events.php
Are you sure?
Though I could be not seeing something elsewhere, @line 113 in ~/concrete/libraries/events.php the fire() function states:My interpretation of that is, ENABLE_APPLICATION_EVENTS must be TRUE or it won't fire any events... regardless of whether or not it is part of a package.
Though I could be not seeing something elsewhere, @line 113 in ~/concrete/libraries/events.php the fire() function states:
if ((!defined('ENABLE_APPLICATION_EVENTS')) || (ENABLE_APPLICATION_EVENTS == false)) { return; }
Thanks Mnkras!
Actually, as of 5.4 it not needed at all, it seems.
Actually, as of 5.4 it not needed at all, it seems.
You just need it if you use site_events.php
Pecked on mah new iPod :)
Pecked on mah new iPod :)
DOH!