isActive() ? 'ss-ui-button current' : 'ss-ui-button'; $linkTitle = _t('SilverStripe\\CMS\\Controllers\\ContentController.ARCHIVEDSITE', 'Preview version'); $recordLink = Convert::raw2att(Controller::join_links( $this->record->AbsoluteLink(), '?archiveDate=' . urlencode($this->record->LastEdited ?? '') )); return "$linkTitle"; } public function getTitle() { return _t('SilverStripe\\CMS\\Controllers\\SilverStripeNavigator.ARCHIVED', 'Archived'); } public function getMessage() { $date = Versioned::current_archived_date(); if (empty($date)) { return null; } /** @var DBDatetime $dateObj */ $dateObj = DBField::create_field('Datetime', $date); $title = _t('SilverStripe\\CMS\\Controllers\\ContentController.NOTEWONTBESHOWN', 'Note: this message will not be shown to your visitors'); return "
"; } public function getLink() { $link = $this->record->PreviewLink(); return $link ? Controller::join_links($link, '?archiveDate=' . urlencode($this->record->LastEdited ?? '')) : ''; } public function canView($member = null) { /** @var Versioned|DataObject $record */ $record = $this->record; return ( $record->hasExtension(Versioned::class) && $record->hasStages() && $this->isArchived() // Don't follow redirects in preview, they break the CMS editing form && !($record instanceof RedirectorPage) && $this->getLink() ); } public function isActive() { return $this->isArchived(); } }