mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Fix edit and delete actions on gridfield
This commit is contained in:
parent
267050171a
commit
23af60633c
@ -58,7 +58,7 @@ class GridFieldAction_Edit implements GridField_ColumnProvider {
|
||||
* @return array
|
||||
*/
|
||||
public function getActions($gridField) {
|
||||
return array('deleterecord');
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,7 +69,7 @@ class GridFieldAction_Edit implements GridField_ColumnProvider {
|
||||
* @return string - the HTML for the column
|
||||
*/
|
||||
public function getColumnContent($gridField, $record, $columnName) {
|
||||
return sprintf('<a class="action-edit" href="%s">%s</a>', Controller::join_links($gridField->Link('item'), $record->ID, 'edit'), _t('GridAction.Edit', 'edit'));
|
||||
return sprintf('<a class="action-edit" href="%s">%s</a> ', Controller::join_links($gridField->Link('item'), $record->ID, 'edit'), _t('GridAction.Edit', 'edit'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -177,12 +177,11 @@ class GridFieldAction_Delete implements GridField_ColumnProvider, GridField_Acti
|
||||
* @return void
|
||||
*/
|
||||
public function handleAction(GridField $gridField, $actionName, $arguments, $data) {
|
||||
$id = $arguments['RecordID'];
|
||||
$item = $gridField->getList()->byID($id);
|
||||
if(!$item) return;
|
||||
|
||||
if($actionName == 'deleterecord') {
|
||||
$item->delete();
|
||||
$id = $arguments['RecordID'];
|
||||
$item = $gridField->getList()->byID($id);
|
||||
if(!$item) return;
|
||||
$item->delete();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user