mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
MemberTableField delete just removes the member from the group
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@62311 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
db0431e8d6
commit
03265942cc
@ -408,6 +408,14 @@ class MemberTableField extends ComplexTableField {
|
||||
$this->sourceItems(); // Called for its side-effect of setting total count
|
||||
return $this->totalCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles item requests
|
||||
* MemberTableField needs its own item request class so that it can overload the delete method
|
||||
*/
|
||||
function handleItem($request) {
|
||||
return new MemberTableField_ItemRequest($this, $request->param('ID'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -473,4 +481,20 @@ class MemberTableField_Popup extends ComplexTableField_Popup {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MemberTableField_ItemRequest extends ComplexTableField_ItemRequest {
|
||||
/**
|
||||
* Deleting an item from a member table field should just remove that member from the group
|
||||
*/
|
||||
function delete() {
|
||||
if($this->ctf->Can('delete') !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$groupID = $this->ctf->sourceID();
|
||||
$this->dataObj()->Groups()->remove($groupID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user