You are here

public function ReusableBlocksController::delete in Gutenberg 8.2

Same name and namespace in other branches
  1. 8 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.

Throws

\Drupal\Core\Entity\EntityStorageException

1 string reference to 'ReusableBlocksController::delete'
gutenberg.routing.yml in ./gutenberg.routing.yml
gutenberg.routing.yml

File

src/Controller/ReusableBlocksController.php, line 136

Class

ReusableBlocksController
Returns responses for our blocks routes.

Namespace

Drupal\gutenberg\Controller

Code

public function delete(Request $request, $block_id = NULL) {
  $block = $this
    ->loadBlockOrThrow($block_id);
  $block
    ->delete();
  return new JsonResponse([
    'id' => (int) $block_id,
  ]);
}