I wonder if it’s possible to add a custom “save & close” button and/or “cancel” button next to the default “save” button in the panel page layout.
Currently when I save I stay on the page, I’d like to go back to the parent pages list.
I guess I have to walk the path of custom plugins with hooks?
Thanks in advance
You could just use hooks to achieve this, i.e. on page.update:after, redirect to whereever.
This is a partly solution, meaning that it’s a redirect after save with current save button. In this case there is no option for staying on the page. I can imagine some use cases where it’s ok to stay on the page after save and leave back to parent page with “cancel” or “save and close”.
Is there a way to add any buttons to the current page top button bar?
Thanks again for the response Sonja.
No out of the box way. Might get a bit cluttered up there as well. I’d check out the Panel header, maybe there is a way to overwrite this.
The question is where would you redirect to, you’d need to know where the user started off, e.g. from the dashboard, from a parent page, from a child page…
Yep, maybe it’s a little to much to intervene like this in current process flow. The hook solution will be sufficient for now.
Thanks again, case closed!
Ok, back again on topic.
Of course I can’t stand that things don’t work out like I want, so i’ve managed to get my custom save button working. All fine except for one thing. If the page is saved after changing some fields content, Kirby uses an internal flag to keep track of pending changes, a red save button appears and a red revert button. In the default Kirby way after the save action, this “flag” is reset bacause there are no pending changes after a save…
How can I set or reset this kirby pending changes flag? Meaning after a change of any input field on the page catching a Kirby event? Or after a successful save resetting this flag.
Currently when I save the page all is fine, data is actually saved (in the backend). But the default Kirbys save and revert buttons stay active… How to reset them…
Thanks in advance.
PS a picture says more than 1000 words: