OnBeforeEmptyTrash
Last updated Apr 12th, 2019 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$306 per month—let's make that $500!
Learn moreEvent: OnBeforeEmptyTrash¶
Fires before the trash is emptied for the site.
- Service: 1 - Parser Service Events
- Group: Documents
Event Parameters¶
Name | Description |
---|---|
ids | An array of Resource IDs that will be permanently deleted. |
Examples of¶
Such a plugin will display the id of remote resources in the "Error log":
<?php
$eventName = $modx->event->name;
switch($eventName) {
case 'OnBeforeEmptyTrash':
// remote resource array
print_r($ids);
break;
}
Such a plugin will display a message stating that there is an important document in the shopping cart and it cannot be deleted:
<?php
$eventName = $modx->event->name;
switch($eventName) {
case 'OnBeforeEmptyTrash':
// if there is a document with id = 26, then do not delete
if (in_array("26", $ids)){
$response = array(
'success' => false,
'message' => 'HEY! There is a document that cannot be deleted!',
'data' => array(),
);
echo $modx->toJSON($response);
exit;
}
break;
}
See Also¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$306 per month—let's make that $500!
Learn more