diff --git a/_config/config.yml b/_config/config.yml index f0259ff..1384d04 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -1,3 +1,7 @@ --- Name: fromholdio-superlinker-menus --- + +SilverStripe\Control\Controller: + extensions: + menuSetParent: Fromholdio\SuperLinkerMenus\Extensions\MenuSetParentAccessorExtension diff --git a/src/Extensions/MenuSetParentAccessorExtension.php b/src/Extensions/MenuSetParentAccessorExtension.php new file mode 100644 index 0000000..2aa5a9e --- /dev/null +++ b/src/Extensions/MenuSetParentAccessorExtension.php @@ -0,0 +1,23 @@ +getManifest() + ->moduleExists('symbiote/silverstripe-multisites'); + $parent = $isMultisites + ? Multisites::inst()->getCurrentSite() + : SiteConfig::current_site_config(); + $this->getOwner()->invokeWithExtensions('updateCurrentMenuSetParent', $parent); + return $parent; + } +}