function BlockVariantTrait::removeBlock
Same name in other branches
- 8.x-3.x src/Plugin/BlockVariantTrait.php \Drupal\ctools\Plugin\BlockVariantTrait::removeBlock()
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\PluginCode
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($event, BlockVariantEvents::DELETE_BLOCK);
return $this;
}