You are here

public function BlockVariantTrait::removeBlock in Chaos Tool Suite (ctools) 8.3

See also

\Drupal\ctools\Plugin\BlockVariantInterface::removeBlock()

File

src/Plugin/BlockVariantTrait.php, line 64

Class

BlockVariantTrait
Provides methods for \Drupal\ctools\Plugin\BlockVariantInterface.

Namespace

Drupal\ctools\Plugin

Code

public function removeBlock($block_id) {
  $block = $this
    ->getBlock($block_id);
  $this
    ->getBlockCollection()
    ->removeInstanceId($block_id);

  // Allow modules to react to the change.
  $event = new BlockVariantEvent($block, $this);
  $this
    ->eventDispatcher()
    ->dispatch(BlockVariantEvents::DELETE_BLOCK, $event);
  return $this;
}