Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUGFIX: GridField delete icon now correctly deletes, rather than alwa…

…ys just unlinking (Fixes 7801)

Fixes the handleAction function of GridFieldDeleteAction which wasn't differentiating between a 'deleterecord' action and an 'unlinkrelation' action.

Fixes http://open.silverstripe.org/ticket/7801
  • Loading branch information...
commit 9a8313dce05d27279675680f1504783d5d61432d 1 parent af2eae7
James Cocker purplespider authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 forms/gridfield/GridFieldDeleteAction.php
6 forms/gridfield/GridFieldDeleteAction.php
View
@@ -133,7 +133,11 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat
if($actionName == 'deleterecord' && !$item->canDelete()) {
throw new ValidationException(_t('GridFieldAction_Delete.DeletePermissionsFailure',"No delete permissions"),0);
}
- $gridField->getList()->remove($item);
+ if($actionName == 'deleterecord') {
+ $item->delete();
+ } else {
+ $gridField->getList()->remove($item);
+ }
}
}
}

1 comment on commit 9a8313d

Lukin

HI, the remove function deletes the related entry, but keeps the relatio of it in the relation table. THis is not how it should be I guess.
v 3.03

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