From: Alexander Ebert Date: Sat, 9 Jul 2016 20:34:23 +0000 (+0200) Subject: Using page settings to build page location X-Git-Tag: 3.0.0_Beta_1~1231^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cddd373d33660c3051413af1f814909b3a0abf17;p=GitHub%2FWoltLab%2FWCF.git Using page settings to build page location --- diff --git a/wcfsetup/install/files/lib/system/breadcrumb/Breadcrumbs.class.php b/wcfsetup/install/files/lib/system/breadcrumb/Breadcrumbs.class.php index aa88926362..6169e515a1 100644 --- a/wcfsetup/install/files/lib/system/breadcrumb/Breadcrumbs.class.php +++ b/wcfsetup/install/files/lib/system/breadcrumb/Breadcrumbs.class.php @@ -1,5 +1,6 @@ items = []; $locations = PageLocationManager::getInstance()->getLocations(); @@ -84,6 +88,28 @@ class Breadcrumbs extends SingletonFactory implements \Countable, \Iterator { // by all relevant ancestors, but breadcrumbs appear in the reverse order $locations = array_reverse($locations); + // use the top-most location to find the path up to the very top of + // the page order + if (!empty($locations)) { + $location = $locations[0]; + + if ($location['pageID']) { + $page = PageCache::getInstance()->getPage($location['pageID']); + while ($page->parentPageID) { + $page = PageCache::getInstance()->getPage($page->parentPageID); + + array_unshift($locations, [ + 'identifier' => $page->identifier, + 'link' => $page->getLink(), + 'pageID' => $page->pageID, + 'pageObjectID' => 0, + 'title' => $page->getTitle(), + 'useAsParentLocation' => false + ]); + } + } + } + // add the landing page as first location, unless it is already included $landingPage = PageCache::getInstance()->getLandingPage(); $addLandingPage = true;