mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
FIX Do not show copy to subsite buttons in history viewer
This commit is contained in:
parent
a1ee94ce61
commit
5f489b1df9
@ -29,6 +29,7 @@ use SilverStripe\Subsites\Model\Subsite;
|
|||||||
use SilverStripe\Subsites\Service\ThemeResolver;
|
use SilverStripe\Subsites\Service\ThemeResolver;
|
||||||
use SilverStripe\Subsites\State\SubsiteState;
|
use SilverStripe\Subsites\State\SubsiteState;
|
||||||
use SilverStripe\View\SSViewer;
|
use SilverStripe\View\SSViewer;
|
||||||
|
use SilverStripe\VersionedAdmin\Controllers\HistoryViewerController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension for the SiteTree object to add subsites support
|
* Extension for the SiteTree object to add subsites support
|
||||||
@ -117,10 +118,12 @@ class SiteTreeSubsites extends DataExtension
|
|||||||
$subsitesMap = new Map(ArrayList::create());
|
$subsitesMap = new Map(ArrayList::create());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$viewingPageHistory = Controller::has_curr() && Controller::curr() instanceof HistoryViewerController;
|
||||||
|
|
||||||
// Master page edit field (only allowed from default subsite to avoid inconsistent relationships)
|
// Master page edit field (only allowed from default subsite to avoid inconsistent relationships)
|
||||||
$isDefaultSubsite = $this->owner->SubsiteID == 0 || $this->owner->Subsite()->DefaultSite;
|
$isDefaultSubsite = $this->owner->SubsiteID == 0 || $this->owner->Subsite()->DefaultSite;
|
||||||
|
|
||||||
if ($isDefaultSubsite && $subsitesMap->count()) {
|
if ($isDefaultSubsite && $subsitesMap->count() && !$viewingPageHistory) {
|
||||||
$fields->addFieldToTab(
|
$fields->addFieldToTab(
|
||||||
'Root.Main',
|
'Root.Main',
|
||||||
ToggleCompositeField::create(
|
ToggleCompositeField::create(
|
||||||
|
Loading…
Reference in New Issue
Block a user