You are here

public function Blocks::addBlock in Context 8

Same name and namespace in other branches
  1. 8.4 src/Plugin/ContextReaction/Blocks.php \Drupal\context\Plugin\ContextReaction\Blocks::addBlock()
  2. 8.0 src/Plugin/ContextReaction/Blocks.php \Drupal\context\Plugin\ContextReaction\Blocks::addBlock()

Add a new block.

Parameters

array $configuration:

File

src/Plugin/ContextReaction/Blocks.php, line 367

Class

Blocks
Provides a content reaction that will let you place blocks in the current themes regions.

Namespace

Drupal\context\Plugin\ContextReaction

Code

public function addBlock(array $configuration) {
  $configuration['uuid'] = $this->uuid
    ->generate();
  $this
    ->getBlocks()
    ->addInstanceId($configuration['uuid'], $configuration);
  return $configuration['uuid'];
}