mirror of
https://github.com/processwire/processwire.git
synced 2025-08-12 17:54:44 +02:00
Add new hooks: Pages::trashReady(), Pages::deleteBranchReady(), Pages::deletedBranch(). The deleteBranch hooks cover the case of recursive deletions where an entire branch of pages is deleted. For those cases, these hooks can be more useful than the regular deleteReady() and deleted() hooks because those two are called for every single page, rather than just for the initiating page.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* Implements page trash/restore/empty methods of the $pages API variable
|
||||
*
|
||||
* ProcessWire 3.x, Copyright 2018 by Ryan Cramer
|
||||
* ProcessWire 3.x, Copyright 2020 by Ryan Cramer
|
||||
* https://processwire.com
|
||||
*
|
||||
*/
|
||||
@@ -45,10 +45,13 @@ class PagesTrash extends Wire {
|
||||
throw new WireException("This page (id=$page->id) may not be placed in the trash");
|
||||
}
|
||||
|
||||
if(!$trash = $this->pages->get($this->config->trashPageID)) {
|
||||
$trash = $this->pages->get($this->config->trashPageID);
|
||||
if(!$trash->id) {
|
||||
throw new WireException("Unable to load trash page defined by config::trashPageID");
|
||||
}
|
||||
|
||||
$this->pages->trashReady($page);
|
||||
|
||||
$page->addStatus(Page::statusTrash);
|
||||
|
||||
if(!$page->parent->isTrash()) {
|
||||
|
Reference in New Issue
Block a user