Keep a more shared understanding of Archived (#2476)

Keep a more shared understanding of Archived
This commit is contained in:
Guy Marriott 2019-09-10 11:33:32 +12:00 committed by GitHub
commit bdf2cccb80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,14 +128,7 @@ abstract class SilverStripeNavigatorItem extends ViewableData
}
if (!isset($record->_cached_isArchived)) {
$baseClass = $record->baseClass();
$currentDraft = Versioned::get_by_stage($baseClass, Versioned::DRAFT)->byID($record->ID);
$currentLive = Versioned::get_by_stage($baseClass, Versioned::LIVE)->byID($record->ID);
$record->_cached_isArchived = (
(!$currentDraft || ($currentDraft && $record->Version != $currentDraft->Version))
&& (!$currentLive || ($currentLive && $record->Version != $currentLive->Version))
);
$record->_cached_isArchived = $record->isArchived();
}
return $record->_cached_isArchived;