I'm having some trouble solving this issue and could do it with some help. Basically, I'm looking to replicate the "Delete (with descendants)" function from the admin panel in a front-end form.
On the front-end at the moment users can delete children or parent pages, but not the parent (and children automatically). I've tried a number of different methods but to no avail.
My front-end is using...
<form method="post" accept-charset="UTF-8" id="delete-page">
{{ csrfInput() }}
{{ hiddenInput('context', 'index') }}
{{ hiddenInput('criteria', '') }}
{{ hiddenInput('elementAction', 'craft\\elements\\actions\\Delete') }}
{{ hiddenInput('elementIds', entry.id) }}
{{ hiddenInput('elementType', 'craft\\elements\\Entry') }}
{{ hiddenInput('hard', false) }}
{{ hiddenInput('source', "section:#{entry.section.uid}") }}
{{ hiddenInput('withDescendants', true) }}
<input type="submit" class="button" class="save" value="Delete P+C" accesskey="v">
</form>
In the Craft Docs, I came across withDescendants but not sure how to utilize this on the front-end.
Any advice here?