diff --git a/_config/extensions.yml b/_config/extensions.yml index 32731f54..976385fb 100644 --- a/_config/extensions.yml +++ b/_config/extensions.yml @@ -64,3 +64,12 @@ SilverStripe\Subsites\Admin\SubsiteAdmin: SilverStripe\SiteConfig\SiteConfigLeftAndMain: extensions: - SilverStripe\Subsites\Extensions\SubsiteMenuExtension + +--- +Name: subsite-preview-elemental +Only: + classexists: DNADesign\Elemental\Models\BaseElement +--- +DNADesign\Elemental\Models\BaseElement: + extensions: + - SilverStripe\Subsites\Extensions\BaseElementSubsites diff --git a/src/Extensions/BaseElementSubsites.php b/src/Extensions/BaseElementSubsites.php new file mode 100644 index 00000000..02235b65 --- /dev/null +++ b/src/Extensions/BaseElementSubsites.php @@ -0,0 +1,33 @@ +owner->SubsiteID; + if (is_null($subsiteID)) { + $page = $this->owner->getPage(); + if ($page) { + $subsiteID = $page->SubsiteID; + } + } + + $link = HTTP::setGetVar('SubsiteID', intval($subsiteID), $link); + } +}