You are here

public function Blocks::addBlock in Context 8.4

Same name and namespace in other branches
  1. 8 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: The configuration from the block.

Return value

string The uuid from the block.

File

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

Class

Blocks
Provides a content reaction.

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'];
}