I am writing a new plugin to hook into a POST event from a bespoke form plugin called "Capture". The Capture plugin fires two different events; the code taken from /craft/plugins/capture/services/Capture_SubmissionsService.php
public function onBeforePost(Event $event) {
$this->raiseEvent('onBeforePost', $event);
}
public function onPost(Event $event) {
$this->raiseEvent('onPost', $event);
}
I called die(); inside each one so I know they are being called.
My new plugin is very simple. I would like to be able to hook into the onPost event and receive the form data. My plugin is very simple for now as I am just concerned with hooking into the event. The below example has getName, getDeveloper, getDescription, getVersion etc removed for ease of reading. This is the only file in my plugin: /craft/plugins/myplugin/MyPlugin.php
<?php
namespace Craft;
class MyPlugin extends BasePlugin {
public function init() {
craft()->on('capture.onPost', function(Event $event){
die('onPost <pre>'.print_r($event,true).'</pre>');
});
}
}
But this doesn't seem to be get called. I am assuming that I need something other than capture.onPost
.
I have used the following docs, but would appreciate any help.