public function BlockVariantTrait::updateBlock in Chaos Tool Suite (ctools) 8.3
See also
\Drupal\ctools\Plugin\BlockVariantInterface::updateBlock()
File
- src/
Plugin/ BlockVariantTrait.php, line 78
Class
- BlockVariantTrait
- Provides methods for \Drupal\ctools\Plugin\BlockVariantInterface.
Namespace
Drupal\ctools\PluginCode
public function updateBlock($block_id, array $configuration) {
$block = $this
->getBlock($block_id);
$existing_configuration = $block
->getConfiguration();
$this
->getBlockCollection()
->setInstanceConfiguration($block_id, $configuration + $existing_configuration);
// Allow modules to react to the change.
$event = new BlockVariantEvent($block, $this);
$this
->eventDispatcher()
->dispatch(BlockVariantEvents::UPDATE_BLOCK, $event);
return $this;
}