From c5798223406a49cd3c1dca3b702b3601d74c74b7 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 24 Nov 2010 06:24:03 +0000 Subject: [PATCH] BUGFIX Don't re-add actions in ModelAdmin->EditForm if they're already present from DataObject->getCMSFields() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@114143 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/ModelAdmin.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/ModelAdmin.php b/code/ModelAdmin.php index 71255a24..dcaa238b 100755 --- a/code/ModelAdmin.php +++ b/code/ModelAdmin.php @@ -947,13 +947,17 @@ class ModelAdmin_RecordController extends Controller { $actions = $this->currentRecord->getCMSActions(); if($this->currentRecord->canEdit(Member::currentUser())){ - $actions->push(new FormAction("doSave", _t('ModelAdmin.SAVE', "Save"))); + if(!$actions->fieldByName('action_doSave') && !$actions->fieldByName('action_save')) { + $actions->push(new FormAction("doSave", _t('ModelAdmin.SAVE', "Save"))); + } }else{ $fields = $fields->makeReadonly(); } if($this->currentRecord->canDelete(Member::currentUser())) { - $actions->insertFirst($deleteAction = new FormAction('doDelete', _t('ModelAdmin.DELETE', 'Delete'))); + if(!$actions->fieldByName('action_doDelete')) { + $actions->insertFirst($deleteAction = new FormAction('doDelete', _t('ModelAdmin.DELETE', 'Delete'))); + } $deleteAction->addExtraClass('delete'); }