From 648cd87d0b2ebc4bf1164df65631e6a9d1d2f678 Mon Sep 17 00:00:00 2001 From: Dylan Wagstaff Date: Tue, 22 Oct 2024 15:00:42 +1300 Subject: [PATCH] Add extension hooks for static file writing Allowing for project level customisation of the environment within which the static content is obtained before it is written. For example allowing third party modules to affect whether their middleware is active or not, which may otherwise prevent accurate content retrieval. --- src/ErrorPage.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ErrorPage.php b/src/ErrorPage.php index 7302c43..e35efb6 100644 --- a/src/ErrorPage.php +++ b/src/ErrorPage.php @@ -322,6 +322,7 @@ public function writeStaticPage() // Run the page (reset the theme, it might've been disabled by LeftAndMain::init()) $originalThemes = SSViewer::get_themes(); try { + $this->extend('onBeforeStaticWrite'); // Restore front-end themes from config $themes = SSViewer::config()->get('themes') ?: $originalThemes; SSViewer::set_themes($themes); @@ -336,6 +337,7 @@ public function writeStaticPage() } finally { // Restore themes SSViewer::set_themes($originalThemes); + $this->extend('onAfterStaticWrite'); } // Make sure we have content to save