deleting flaglist_collection from ui
This commit is contained in:
@@ -12,4 +12,12 @@ materio_flag.create_user_flagging_collection:
|
||||
_controller: '\Drupal\materio_flag\Controller\MaterioFlagController::createUserFlaggingCollection'
|
||||
_title: 'Create User Flagging Collection'
|
||||
requirements:
|
||||
_permission: 'access content'
|
||||
_permission: 'add flag lists'
|
||||
|
||||
materio_flag.delete_user_flagging_collection:
|
||||
path: 'materio_flag/delete_user_flagging_collection'
|
||||
defaults:
|
||||
_controller: '\Drupal\materio_flag\Controller\MaterioFlagController::deleteUserFlaggingCollection'
|
||||
_title: 'Delete User Flagging Collection'
|
||||
requirements:
|
||||
_permission: 'edit own flag lists'
|
||||
|
@@ -88,5 +88,19 @@ class MaterioFlagController extends ControllerBase {
|
||||
return new JsonResponse($data);
|
||||
}
|
||||
|
||||
public function deleteUserFlaggingCollection(Request $request) {
|
||||
// dpm($request);
|
||||
$post_data = json_decode( $request->getContent(),TRUE);
|
||||
$flagid = $post_data['flagid'];
|
||||
|
||||
$flagcoll = $this->flaglists->getFlaggingCollectionById($flagid);
|
||||
$result = $flagcoll->delete();
|
||||
|
||||
$data = [
|
||||
'result' => $result,
|
||||
'id' => $flagid
|
||||
];
|
||||
return new JsonResponse($data);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user