I currently have a plugin which needs to do things on save and delete entry events. My save entry code is all working perfectly but the onDeleteEntry code doesn't ever fire when I delete an entry.
I have tried using the event both ways mentioned in the documentation
craft()->entries->onDeleteEntry = function(Event $event) {
$entry = $event->params['entry'];
//etc etc
};
and
craft()->on('entries.deleteEntry', function(Event $event) {
$entry = $event->params['entry'];
//etc etc
});
both of these are inside the init function.
Does anyone know if there is a particular way this event needs to be used that differs from the onSaveEntry event, which works fine?
Here's a link to the events reference https://craftcms.com/docs/plugins/hooks-and-events#events