diff --git a/code/extensions/LeftAndMainSubsites.php b/code/extensions/LeftAndMainSubsites.php index 9079b41c..51887bf5 100644 --- a/code/extensions/LeftAndMainSubsites.php +++ b/code/extensions/LeftAndMainSubsites.php @@ -348,12 +348,11 @@ public function onAfterSave($record) /** * @param array $data - * @param Form $form */ - public function copytosubsite($data, $form) + public function copytosubsite($data) { - $page = DataObject::get_by_id(SiteTree::class, $data['ID']); - $subsite = DataObject::get_by_id('Subsite', $data['CopyToSubsiteID']); + $page = SiteTree::get()->byID($data['ID']); + $subsite = Subsite::get()->byID($data['CopyToSubsiteID']); $includeChildren = isset($data['CopyToSubsiteWithChildren']) ? $data['CopyToSubsiteWithChildren'] : false; $newPage = $page->duplicateToSubsite($subsite->ID, $includeChildren); diff --git a/code/extensions/SiteTreeSubsites.php b/code/extensions/SiteTreeSubsites.php index f281a19f..5a450ed0 100644 --- a/code/extensions/SiteTreeSubsites.php +++ b/code/extensions/SiteTreeSubsites.php @@ -12,7 +12,7 @@ use SilverStripe\Forms\CheckboxField; use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\FieldList; -use SilverStripe\Forms\InlineFormAction; +use SilverStripe\Forms\FormAction; use SilverStripe\Forms\ToggleCompositeField; use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataObject; @@ -109,7 +109,7 @@ public function updateCMSFields(FieldList $fields) $isDefaultSubsite = $this->owner->SubsiteID == 0 || $this->owner->Subsite()->DefaultSite; if ($isDefaultSubsite && $subsitesMap) { - $fields->addFieldsToTab( + $fields->addFieldToTab( 'Root.Main', ToggleCompositeField::create('SubsiteOperations', _t('SiteTreeSubsites.SubsiteOperations', 'Subsite Operations'), @@ -118,7 +118,7 @@ public function updateCMSFields(FieldList $fields) 'Copy page to subsite'), $subsitesMap), new CheckboxField('CopyToSubsiteWithChildren', _t('SiteTreeSubsites.CopyToSubsiteWithChildren', 'Include children pages?')), - $copyAction = new InlineFormAction( + $copyAction = new FormAction( 'copytosubsite', _t('SiteTreeSubsites.CopyAction', 'Copy') )