From 5346b1830ed0bab863ec4a3a95f9345e4ac93825 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 21 May 2016 13:39:03 +0200 Subject: [PATCH] Fixed `WCF::getActivePage()` failing for CMS pages --- wcfsetup/install/files/lib/system/WCF.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index d0bc4c7b95..c349b58029 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -7,6 +7,7 @@ use wcf\data\package\PackageCache; use wcf\data\package\PackageEditor; use wcf\data\page\Page; use wcf\data\page\PageCache; +use wcf\page\CmsPage; use wcf\system\application\ApplicationHandler; use wcf\system\application\IApplication; use wcf\system\box\BoxHandler; @@ -805,6 +806,11 @@ class WCF { * @return Page|null */ public static function getActivePage() { + if (self::getActiveRequest()->getClassName() === CmsPage::class) { + $metaData = self::getActiveRequest()->getMetaData(); + return PageCache::getInstance()->getPage($metaData['cms']['pageID']); + } + return PageCache::getInstance()->getPageByController(self::getActiveRequest()->getClassName()); } -- 2.20.1