BUGFIX Checking for existence of draft and live records in SilverStripeNavigatorItem_ArchiveLink->getHTML() (from r115130)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@115442 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2011-01-11 23:04:49 +00:00 committed by Sam Minnee
parent 3e8cc481f0
commit c336545cd7

View File

@ -161,7 +161,10 @@ 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 && $currentLive && $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>";
}
@ -183,4 +186,4 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
}
}
?>
?>