Hook panel.page.delete before or after delete

is it right that this is called after the page folder is gone? i wanted create a backup zip on this hook but it fails.

https://getkirby.com/docs/developer-guide/advanced/hooks

Yes, that’s correct, the hook is triggered after everything else has been deleted, as you can see in the delete method:

public function delete($force = false) {

    // check if the delete option is available
    if($this->options()->delete() === false) {
      throw new PermissionsException();
    }

    // create the delete event
    $event = $this->event('delete:action');

    // check for permissions
    $event->check();

    // delete the page
    parent::delete(true);

    // resort the siblings
    $this->sorter()->delete();

    // remove unsaved changes
    $this->changes()->discard();

    // delete all associated thumbs
    $this->removeThumbs();

    // hit the hook
    kirby()->trigger($event, $this);

  }

i see. knowing something has been deleted is quiet useless to me. thus i would like to request a ‘before-delete’ hook. shall i open a ticket at github?

1 Like

Sure, please feel free to do that, Bruno. Needless to say that not all wishes come true, but with a feature request on GitHub you definitely have higher chances in the lottery. I think there is an issue with hook wishes already, please check if that already contains pre-something features.

i only found @jenstornell post which is related to doing something before a template code using some sort of hook. but not a hook feature list. so i created a new issue.

My issue is about something else which I now have a plugin for: https://github.com/jenstornell/kirby-starthook

1 Like