BUGFIX: GridField delete icon now correctly deletes, rather than always 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
This commit is contained in:
James Cocker 2012-08-21 23:31:34 +01:00
parent af2eae760f
commit 9a8313dce0

View File

@ -133,7 +133,11 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio
if($actionName == 'deleterecord' && !$item->canDelete()) {
throw new ValidationException(_t('GridFieldAction_Delete.DeletePermissionsFailure',"No delete permissions"),0);
}
if($actionName == 'deleterecord') {
$item->delete();
} else {
$gridField->getList()->remove($item);
}
}
}
}