diff --git a/src/ErrorPageController.php b/src/ErrorPageController.php index 628c4b3..b4456cf 100644 --- a/src/ErrorPageController.php +++ b/src/ErrorPageController.php @@ -4,12 +4,24 @@ use PageController; use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPResponse; +use SilverStripe\View\SSViewer; /** * Controller for ErrorPages. */ class ErrorPageController extends PageController { + /** + * Explicitly set themes to the themes config value in case the theme was previously set to something else + * One example of this is when serving 404 error pages under the admin path e.g. admin/non-existent + * where LeftAndMain::init() will have previously set themes to the admin_themes config + */ + protected function init() + { + SSViewer::set_themes(SSViewer::config()->themes); + parent::init(); + } + /** * Overload the provided {@link Controller::handleRequest()} to append the * correct status code post request since otherwise permission related error