Closed jenstornell closed 3 years ago
If I understand your use-case correctly, you want to overwrite the way the plugin stores custom fields by running your code after the plugin's code has been run. I'm not so sure about this as that's a hack.
Every time we need to manipulate the data, there is no reason to save the file two times. Instead, it would be better if the manipulation would occur before the save, similar to a filter.
Hooks are good to use as triggers. Filters are good to use for preparing the data before the save.
It would happen in this order:
But because there already are filters, maybe there is a better name for it.
Makes sense. :)
I thought there was an issue about it but it seems like it's not.
Hook before save
A hook that runs before save would be helpful in situations where the content needs to be manipulated before save.
If we use for example an update hook, it would write the file and then run the hook that will write to the file again. It will write to the file two times on each save.
A real case is this issue
https://github.com/Addpixel/KirbyComments/issues/35
In short, I want to flatten a nested structure before the content is saved.
Maybe it should be called
pre-hook
or perhapspanel-filter
. I think panel filter is better.