mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 09:05:57 +00:00
Make delete handler respect canDelete
(#142)
This commit is contained in:
parent
3aad957a69
commit
c7a275a7a6
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Bulk action handler for deleting records.
|
* Bulk action handler for deleting records.
|
||||||
*
|
*
|
||||||
* @author colymba
|
* @author colymba
|
||||||
*/
|
*/
|
||||||
class GridFieldBulkActionDeleteHandler extends GridFieldBulkActionHandler
|
class GridFieldBulkActionDeleteHandler extends GridFieldBulkActionHandler
|
||||||
@ -24,7 +24,7 @@ class GridFieldBulkActionDeleteHandler extends GridFieldBulkActionHandler
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the selected records passed from the delete bulk action.
|
* Delete the selected records passed from the delete bulk action.
|
||||||
*
|
*
|
||||||
* @param SS_HTTPRequest $request
|
* @param SS_HTTPRequest $request
|
||||||
*
|
*
|
||||||
* @return SS_HTTPResponse List of deleted records ID
|
* @return SS_HTTPResponse List of deleted records ID
|
||||||
@ -34,8 +34,10 @@ class GridFieldBulkActionDeleteHandler extends GridFieldBulkActionHandler
|
|||||||
$ids = array();
|
$ids = array();
|
||||||
|
|
||||||
foreach ($this->getRecords() as $record) {
|
foreach ($this->getRecords() as $record) {
|
||||||
array_push($ids, $record->ID);
|
if ($record->canDelete()) {
|
||||||
$record->delete();
|
array_push($ids, $record->ID);
|
||||||
|
$record->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new SS_HTTPResponse(Convert::raw2json(array(
|
$response = new SS_HTTPResponse(Convert::raw2json(array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user