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
This commit is contained in:
Ingo Schommer 2010-11-24 06:24:03 +00:00
parent e1a270a0b1
commit c579822340

View File

@ -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');
}