changed to static function so that subclasses of Versioned will be picked up

This commit is contained in:
John Milmine 2017-05-04 15:05:25 +12:00
parent 0ef3844dd4
commit 618c7f126d

View File

@ -196,8 +196,8 @@ class SilverStripeNavigatorItem extends ViewableData {
* @return boolean
*/
public function isArchived() {
if(!$this->record->hasExtension('Versioned')) return false;
if(!Object::has_extension($this->record->ClassName, 'Versioned')) return false;
if(!isset($this->record->_cached_isArchived)) {
$baseTable = ClassInfo::baseDataClass($this->record->class);
$currentDraft = Versioned::get_one_by_stage($baseTable, 'Stage', array(
@ -294,7 +294,7 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
public function canView($member = null) {
return (
$this->record->hasExtension('Versioned')
Object::has_extension($this->record->ClassName, 'Versioned')
&& $this->getDraftPage()
// Don't follow redirects in preview, they break the CMS editing form
&& !($this->record instanceof RedirectorPage)
@ -351,7 +351,7 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
public function canView($member = null) {
return (
$this->record->hasExtension('Versioned')
Object::has_extension($this->record->ClassName, 'Versioned')
&& $this->getLivePage()
// Don't follow redirects in preview, they break the CMS editing form
&& !($this->record instanceof RedirectorPage)
@ -418,7 +418,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
public function canView($member = null) {
return (
$this->record->hasExtension('Versioned')
Object::has_extension($this->record->ClassName, 'Versioned')
&& $this->isArchived()
// Don't follow redirects in preview, they break the CMS editing form
&& !($this->record instanceof RedirectorPage)