Chunks for confirming deletion
When a Delete command is given to the snippet along with an item ID, the output is a form prompting for confirmation or cancellation, and showing some detail to identify the item clearly. This form is defined in a MODx chunk.
The default deletion chunk is called pk.ConfirmDeletion.tpl, and expects an item to have fields called title and headline. The [+returnId+] placeholder (document ID or alias) identifies the page to be loaded after deletion has been carried out. It is normalluy supplied as a GET or POST variable by the page requesting the Delete command.
<input name="confirmDeletion" type="hidden" value="on" />
<input type="hidden" name="docId" value="[+docId+]">
<input type="hidden" name="returnId" value="[+returnId+]">
<p>Delete item headlined:<br />
[+title+] <br />
[+headline+]?</p>
<input name="delete" type="submit" value="Yes" />
<input name="erase" type="submit" value="No" />
</form>
A more specific prompt can be set in the item type's class definition (see the Player class for an example):
- $delForm indicates the name of a chunk to use (default is pk.item.delete.tpl);
- $delMsg is an item-type specific prompt that is set up as part of the item's constructor function, using whatever fields are relevant. The message is inserted in the chunk using the [+delMsg+] placeholder.
<input name="confirmDeletion" type="hidden" value="on" />
<input type="hidden" name="docId" value="[+docId+]">
<input type="hidden" name="returnId" value="[+returnId+]">
<p> Delete [+delMsg+] </p>
<input name="delete" type="submit" value="Yes" />
<input name="erase" type="submit" value="No" />
</form>
This message can also use the language setting, unlike pk.ConfirmDeletion.tpl, where the chunk itself has to be edited for languages other than English.