BUGFIX Fixed edge case bug where SilverStripeNavigatorItem would fail if a page was not published, and the navigator archive link was generated

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@115437 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2011-01-11 22:45:21 +00:00 committed by Sam Minnee
parent 014087f0f7
commit b81cae875a

View File

@ -31,7 +31,6 @@ class SilverStripeNavigator {
ksort($menuPriority);
foreach($menuPriority as $obj) {
$text = $obj->getHTML($record);
if($text) $items .= $text;
$newMessage = $obj->getMessage($record);
@ -162,7 +161,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
// Display the archive link if the page currently displayed in the CMS is other version than live and draft
$currentDraft = Versioned::get_one_by_stage('SiteTree', 'Draft', '"SiteTree"."ID" = ' . $page->ID);
$currentLive = Versioned::get_one_by_stage('SiteTree', 'Live', '"SiteTree"."ID" = ' . $page->ID);
if ($currentDraft && $page->Version!=$currentDraft->Version && $page->Version!=$currentLive->Version) {
if ($currentDraft && $currentLive && $page->Version != $currentDraft->Version && $page->Version != $currentLive->Version) {
$pageLink = $page->AbsoluteLink();
return "<a href=\"$pageLink?archiveDate={$page->LastEdited}\" class=\"newWindow\" target=\"site\" style=\"left : -3px;\">". _t('ContentController.ARCHIVEDSITE', 'Archived Site') ."</a>";
}