diff --git a/_config/extensions.yml b/_config/extensions.yml index fdc21e0..4d60372 100644 --- a/_config/extensions.yml +++ b/_config/extensions.yml @@ -4,10 +4,8 @@ Only: classexists: '\SilverStripe\Subsites\Model\Subsite' --- SilverStripe\Subsites\Model\Subsite: - has_many: - - MenuSets => 'Heyday\MenuManager\MenuSet' - cascade_deletes: - - MenuSets + extensions: + - Heyday\MenuManager\Extensions\SubsiteExtension Heyday\MenuManager\MenuAdmin: extensions: - SilverStripe\Subsites\Extensions\SubsiteMenuExtension diff --git a/src/Extensions/MenuSubsiteExtension.php b/src/Extensions/MenuSubsiteExtension.php index 4fdbe34..3a23288 100644 --- a/src/Extensions/MenuSubsiteExtension.php +++ b/src/Extensions/MenuSubsiteExtension.php @@ -6,7 +6,6 @@ use SilverStripe\Forms\FieldList; use SilverStripe\Forms\HiddenField; use SilverStripe\ORM\DataExtension; -use SilverStripe\Subsites\State\SubsiteState; if (!class_exists('\SilverStripe\Subsites\Model\Subsite') || !class_exists('\SilverStripe\Subsites\State\SubsiteState')) { return; diff --git a/src/Extensions/SubsiteExtension.php b/src/Extensions/SubsiteExtension.php new file mode 100644 index 0000000..cf6bf66 --- /dev/null +++ b/src/Extensions/SubsiteExtension.php @@ -0,0 +1,28 @@ + MenuSet::class + ]; + + private static $cascade_deletes = [ + 'MenuSets' + ]; + + public function updateCMSFields(FieldList $fields) + { + $fields->removeByName('MenuSets'); + } +}