From 4046fed60f3950f1ceca2a0b8aa79cc8d8a020e0 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 27 Oct 2021 14:23:39 +0300 Subject: [PATCH] Changelog update --- CHANGELOG.md | 6 ++++++ .../Grav/Common/Processors/PagesProcessor.php | 20 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5320a0e5a..0641d2bb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.7.25 +## mm/dd/2021 + +1. [](#improved) + * Added `route` and `request` to `onPagesInitialized` event + # v1.7.24 ## 10/26/2021 diff --git a/system/src/Grav/Common/Processors/PagesProcessor.php b/system/src/Grav/Common/Processors/PagesProcessor.php index 470ca907b..36f6718d2 100644 --- a/system/src/Grav/Common/Processors/PagesProcessor.php +++ b/system/src/Grav/Common/Processors/PagesProcessor.php @@ -42,15 +42,29 @@ class PagesProcessor extends ProcessorBase $this->container['debugger']->addMessage($this->container['cache']->getCacheStatus()); $this->container['pages']->init(); - $this->container->fireEvent('onPagesInitialized', new Event(['pages' => $this->container['pages']])); - $this->container->fireEvent('onPageInitialized', new Event(['page' => $this->container['page']])); + + $route = $this->container['route']; + + $this->container->fireEvent('onPagesInitialized', new Event( + [ + 'pages' => $this->container['pages'], + 'route' => $route, + 'request' => $request + ] + )); + $this->container->fireEvent('onPageInitialized', new Event( + [ + 'page' => $this->container['page'], + 'route' => $route, + 'request' => $request + ] + )); /** @var PageInterface $page */ $page = $this->container['page']; if (!$page->routable()) { $exception = new RequestException($request, 'Page Not Found', 404); - $route = $this->container['route']; // If no page found, fire event $event = new Event([ 'page' => $page,