public function ReusableBlocksController::delete in Gutenberg 8
Same name and namespace in other branches
- 8.2 src/Controller/ReusableBlocksController.php \Drupal\gutenberg\Controller\ReusableBlocksController::delete()
Delete reusable block.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request.
string $block_id: The reusable block id.
Return value
\Symfony\Component\HttpFoundation\JsonResponse The JSON response.
1 string reference to 'ReusableBlocksController::delete'
File
- src/
Controller/ ReusableBlocksController.php, line 135
Class
- ReusableBlocksController
- Returns responses for our blocks routes.
Namespace
Drupal\gutenberg\ControllerCode
public function delete(Request $request, $block_id = NULL) {
$block = BlockContent::load($block_id);
$block
->delete();
return new JsonResponse([
'id' => (int) $block_id,
]);
}