Skip to content
Browse files

BUGFIX Don't re-add actions in ModelAdmin->EditForm if they're alread…

…y present from DataObject->getCMSFields()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@114143 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent e1a270a commit c5798223406a49cd3c1dca3b702b3601d74c74b7 @chillu chillu committed Nov 24, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 code/ModelAdmin.php
View
8 code/ModelAdmin.php
@@ -947,13 +947,17 @@ public function EditForm() {
$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');
}

0 comments on commit c579822

Please sign in to comment.
Something went wrong with that request. Please try again.