MINOR Documentation

This commit is contained in:
Ingo Schommer 2012-03-01 17:06:15 +01:00
parent 04698ac295
commit aa2e610a20
2 changed files with 7 additions and 4 deletions

View File

@ -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();

View File

@ -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 {