Merge pull request #1810 from dnadesign/fix_silverstripenavigator_versioned_subclasses

using static function so that subclasses of Versioned will be picked up
This commit is contained in:
Daniel Hensby 2017-07-17 16:16:33 +01:00 committed by GitHub
commit b499e077b1

View File

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