Fixed `WCF::getActivePage()` failing for CMS pages
authorAlexander Ebert <ebert@woltlab.com>
Sat, 21 May 2016 11:39:03 +0000 (13:39 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 21 May 2016 11:39:03 +0000 (13:39 +0200)
wcfsetup/install/files/lib/system/WCF.class.php

index d0bc4c7b955145af6fa85d15e48c5a0fcb281bdd..c349b58029ac3af0974c1d8a0a3321f3a47f0d0a 100644 (file)
@@ -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());
        }