From a8e6aedd043107a3eb2dc47bc7e2509ffb6b6db5 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 30 Mar 2021 19:14:49 +0300 Subject: [PATCH] Fixed missing `onAdminAfterDelete` event call in `Flex Pages` --- CHANGELOG.md | 1 + .../Grav/Common/Flex/Types/Pages/PageObject.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77ae84781..234dba339 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * Fixed moving `Flex Page` to itself causing the page to be lost [#3227](https://github.com/getgrav/grav/issues/3227) * Fixed `PageStorage` from detecting files as pages * Fixed `UserIndex` not implementing `UserCollectionInterface` + * Fixed missing `onAdminAfterDelete` event call in `Flex Pages` # v1.7.9 ## 03/19/2021 diff --git a/system/src/Grav/Common/Flex/Types/Pages/PageObject.php b/system/src/Grav/Common/Flex/Types/Pages/PageObject.php index c8568cf74..63f4cd4d4 100644 --- a/system/src/Grav/Common/Flex/Types/Pages/PageObject.php +++ b/system/src/Grav/Common/Flex/Types/Pages/PageObject.php @@ -298,6 +298,22 @@ class PageObject extends FlexPageObject return $instance; } + /** + * @return PageObject + */ + public function delete() + { + $result = parent::delete(); + + // Backwards compatibility with older plugins. + $fireEvents = $this->isAdminSite() && $this->getFlexDirectory()->getConfig('object.compat.events', true); + if ($fireEvents) { + $this->grav->fireEvent('onAdminAfterDelete', new Event(['object' => $this])); + } + + return $result; + } + /** * Prepare move page to new location. Moves also everything that's under the current page. *