mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Documentation
This commit is contained in:
parent
04698ac295
commit
aa2e610a20
@ -94,8 +94,8 @@ class GridFieldAction_Edit implements GridField_ColumnProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is an GridField Component that add Delete action for Objects in the GridField
|
||||
*
|
||||
* This class is an GridField Component that add Delete action for Objects in the GridField.
|
||||
* See {@link GridFieldRelationDelete} for detaching an item from the current relationship instead.
|
||||
*/
|
||||
class GridFieldAction_Delete implements GridField_ColumnProvider, GridField_ActionProvider {
|
||||
|
||||
@ -187,6 +187,7 @@ class GridFieldAction_Delete implements GridField_ColumnProvider, GridField_Acti
|
||||
public function handleAction(GridField $gridField, $actionName, $arguments, $data) {
|
||||
if($actionName == 'deleterecord') {
|
||||
$id = $arguments['RecordID'];
|
||||
// Always deletes a record. Use GridFieldRelationDelete to detach it from the current relationship.
|
||||
$item = $gridField->getList()->byID($id);
|
||||
if(!$item) return;
|
||||
$item->delete();
|
||||
|
@ -1,7 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* GridFieldRelationDelete
|
||||
*
|
||||
* Allows to detach an item from an existing has_many or many_many relationship.
|
||||
* Similar to {@link GridFieldAction_Delete}, but allows to distinguish between
|
||||
* a "delete" and "detach" action in the UI - and to use both in parallel, if required.
|
||||
* Requires the GridField to be populated with a RelationList rather than a plain DataList.
|
||||
*/
|
||||
class GridFieldRelationDelete implements GridField_ColumnProvider, GridField_ActionProvider {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user