diff --git a/src/Extensions/ElementalAreasContainer.php b/src/Extensions/ElementalAreasContainer.php index bbd29e4..43df3e6 100644 --- a/src/Extensions/ElementalAreasContainer.php +++ b/src/Extensions/ElementalAreasContainer.php @@ -42,13 +42,19 @@ public function onAfterDuplicate(DataObject $original, bool $doWrite): void public function updateCMSActions(FieldList $actions) { - $actions->push( - $action = CustomAction::create('doPublishWithAreas', 'Publish (including all blocks)') - ->setShouldRefresh(true) - ->addExtraClass('btn-outline-primary') - ->removeExtraClass('btn-info') - ); - $action->setAttribute('style', 'margin-left:auto;'); + $action = CustomAction::create('doPublishWithAreas', 'Publish (including all blocks)') + ->setShouldRefresh(true) + ->addExtraClass('btn-outline-primary') + ->removeExtraClass('btn-info'); + + $MajorActions = $actions->fieldByName('MajorActions'); + + if ($MajorActions) { + $MajorActions->push($action); + } else { + $actions->push($action); + $action->setAttribute('style', 'margin-left:auto;'); + } } public function doPublishWithAreas()