Jump to content

Hook on page save but not trashed


nabo
 Share

Recommended Posts

Not sure if there is a hook that will exclude trashed pages directly, but you can very easily check status changes inside the Pages::saved hook, and abort the hook if the page is / was trashed. Use $page->statusPrevious to get the previous status, then you can compare it with the current status. See this hook in my TrelloWire module, which reacts to status changes. In this case I check both the current and previous status, because I'm only interested in the changes. Note that statusPrevious will be null if the status hasn't changed. If you only care about whether the page is currently in the trash, you can just use $page->isTrash().

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...