From: Alexander Ebert Date: Wed, 2 Jan 2013 01:26:21 +0000 (+0100) Subject: Fixed menu item handling for landing page X-Git-Tag: 2.0.0_Beta_1~606^2~9 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=522f7d1f98c2826827ae2af0e5ea73b87514c397;p=GitHub%2FWoltLab%2FWCF.git Fixed menu item handling for landing page Fixes #1066 --- diff --git a/wcfsetup/install/files/lib/system/breadcrumb/Breadcrumbs.class.php b/wcfsetup/install/files/lib/system/breadcrumb/Breadcrumbs.class.php index c08ea140d9..275a418586 100644 --- a/wcfsetup/install/files/lib/system/breadcrumb/Breadcrumbs.class.php +++ b/wcfsetup/install/files/lib/system/breadcrumb/Breadcrumbs.class.php @@ -30,14 +30,8 @@ class Breadcrumbs extends SingletonFactory implements \Countable, \Iterator { * @see wcf\system\SingletonFactory::init() */ protected function init() { - // set default menu item - $landingPage = PageMenu::getInstance()->getLandingPage(); - if ($landingPage !== null) { - PageMenu::getInstance()->setActiveMenuItem($landingPage->menuItem); - - // add main breadcrumbs entry - $this->add(new Breadcrumb(WCF::getLanguage()->get(PAGE_TITLE), $landingPage->getLink())); - } + // add main breadcrumbs entry + $this->add(new Breadcrumb(WCF::getLanguage()->get(PAGE_TITLE), PageMenu::getInstance()->getLandingPage()->getLink())); } /** diff --git a/wcfsetup/install/files/lib/system/menu/page/PageMenu.class.php b/wcfsetup/install/files/lib/system/menu/page/PageMenu.class.php index e6b75edcf4..5f8a9aad0e 100644 --- a/wcfsetup/install/files/lib/system/menu/page/PageMenu.class.php +++ b/wcfsetup/install/files/lib/system/menu/page/PageMenu.class.php @@ -3,6 +3,7 @@ namespace wcf\system\menu\page; use wcf\system\breadcrumb\Breadcrumb; use wcf\system\cache\CacheHandler; use wcf\system\event\EventHandler; +use wcf\system\exception\SystemException; use wcf\system\menu\ITreeMenuItem; use wcf\system\menu\TreeMenu; use wcf\system\WCF; @@ -11,7 +12,7 @@ use wcf\system\WCF; * Builds the page menu. * * @author Marcel Werk - * @copyright 2001-2012 WoltLab GmbH + * @copyright 2001-2013 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage system.menu.page @@ -50,6 +51,12 @@ class PageMenu extends TreeMenu { } } } + + if ($this->landingPage === null) { + throw new SystemException("Missing landing page"); + } + + $this->setActiveMenuItem($this->landingPage->menuItem); } /**