Permalink
Browse files

BUGFIX Checking for existence of draft and live records in SilverStri…

…peNavigatorItem_ArchiveLink->getHTML()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@115130 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 2fa786d commit ac2d6fa6d897b9a2cdc95e2cf3a9888b41cd6674 @chillu chillu committed Dec 16, 2010
Showing with 4 additions and 1 deletion.
  1. +4 −1 core/control/SilverStripeNavigatorItem.php
@@ -161,7 +161,10 @@ function getHTML($page) {
// 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 || ($currentDraft && $page->Version != $currentDraft->Version))
+ && (!$currentLive || ($currentLive && $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>";
}

0 comments on commit ac2d6fa

Please sign in to comment.