mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
FIX Ensure unstaged versioned objects can be previewed.
This commit is contained in:
parent
3a990c95f5
commit
83104da329
@ -40,12 +40,24 @@ class SilverStripeNavigatorItem_Unversioned extends SilverStripeNavigatorItem
|
||||
public function canView($member = null)
|
||||
{
|
||||
return (
|
||||
!$this->getRecord()->hasExtension(Versioned::class)
|
||||
$this->recordIsUnversioned()
|
||||
&& $this->showUnversionedLink()
|
||||
&& $this->getLink()
|
||||
);
|
||||
}
|
||||
|
||||
private function recordIsUnversioned(): bool
|
||||
{
|
||||
$record = $this->getRecord();
|
||||
// If the record has the Versioned extension, it can be considered unversioned
|
||||
// for the purposes of this class if it has no stages and is not archived.
|
||||
if ($record->hasExtension(Versioned::class)) {
|
||||
return (!$record->hasStages()) && !$this->isArchived();
|
||||
}
|
||||
// Completely unversioned.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the record is configured to display this item.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user