deleting flaglist_collection from ui

This commit is contained in:
2020-11-19 19:02:04 +01:00
parent 41177bd4e6
commit a8645a4b2a
11 changed files with 188 additions and 19 deletions

View File

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

View File

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