I think you could āhackā in a custom delete action. Depending on where you need to be able to delete a page.
Doing this for the sidebar only would be relatively easy. Expanding it to the context menu should be doable as well. I think.
You could add a custom delete link in the sidebar with javascript pointing to a custom route where you can delete the page with $force = true.
I agree with @lukaskleinschmidt, that option is preferable to hacking the panel, you can then still update Kirby without any problems and you donāt run into issues, because the Panel code is rather complex.
I totally agree with @texnixe and @lukaskleinschmidt and would love to have a custom delete action. Itās a bit hacky too, though as we canāt extend the sidebar without duplicating fields with Javascript, yet. Or is there something Iām missing?
I had another look at the Kirby core, and as is all too often the case I found the lines preventing pages with subpages to be deleted.
Maybe this helps with the development of a custom delete action. Or as a last resort you can temporarily change this in the core as Iām positive this will be possible in the next Kirby version.
Yes, itās crazy. I changed so many instances of delete in the Kirby and Panel folders and each and every time a new layer of protection came around. But now after some time I just changed two files and it works.
Iām still in disbelief itās that easy, did you test it already?
EDIT:
As Iām changing the delete() function to never break when there are subpages, and since thereās no second warning in the panel, itās definitely not an ideal solution. Keep that in mind when using this.
No, not yet, I have some other stuff to do right now. Sometimes itās just difficult to find the right lines to change. Does not look as if that would interfere with permissions.
Thanks @thguenther! I made a comment to your commit with a proposed change that allows you to use the deletable: false blueprint setting to prevent certain pages to be deleted.
Wow, thatās super clean. Especially the action path delete/force really makes sense.
Adding a page to a page which does not yet have child pages results in two instances of āDelete pageā for me. Can you reproduce that? It doesnāt happen when adding additional subpages.
The one on the bottom seems to think itās still on the parent page as the path is not the subpage but the parent page. Maybe the redirect to the child after creating it has something to do with it?