Page Type Events

Permalink
I am trying to extend the on_page_delete event but it doesn't seem to work.

I have setup the config files as instructed in the documentation and have a page type controller in controllers/page_types named
NewsItemPageTypeController.but when i delete a page the method in my controller is not getting called.

lookstechnical
 
ryan replied on at Permalink Reply
ryan
First test to make sure your controller is called at all.


public function view() {
  echo "view function called";
}


If that's not getting called, then you probably have your controller or the controller file named incorrectly.

Based on your class name, I'd expect your file to be:
/controllers/page_types/news_item.php

And for that class to extend Controller

For testing the delete function you could do:
public function on_page_delete($c) {
  Log::addEntry($c->getCollectionName()." deleted");
}
lookstechnical replied on at Permalink Reply
lookstechnical
Thanks for the quick reply Ryan, The controller was being called.

The problem is that the on_page_delete function is not being called when deleting pages from the Sitemap window only when deleting from the move /delete window.

Any ideas why the event is not being fired when deleting from the sitemap window?

I have looked through the code and both unless im mistaken are calling the Page->delete method which fires the on_page_delete event ?