Skip to content

Commit

Permalink
BUGFIX Don't re-add actions in ModelAdmin->EditForm if they're alread…
Browse files Browse the repository at this point in the history
…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
chillu committed Nov 24, 2010
1 parent e1a270a commit c579822
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions code/ModelAdmin.php
Expand Up @@ -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');
}

Expand Down

0 comments on commit c579822

Please sign in to comment.