You are here

public function Context::addReaction in Context 8

Same name and namespace in other branches
  1. 8.4 src/Entity/Context.php \Drupal\context\Entity\Context::addReaction()
  2. 8.0 src/Entity/Context.php \Drupal\context\Entity\Context::addReaction()

Add a context reaction.

Parameters

array $configuration:

Return value

string

Overrides ContextInterface::addReaction

File

src/Entity/Context.php, line 321

Class

Context
Defines the Context entity.

Namespace

Drupal\context\Entity

Code

public function addReaction(array $configuration) {

  // Add an UUID to the condition to make sure the configuration is saved
  // since the configuration export from the conditions collection wont
  // export configuration that has not been "configured".
  $configuration['uuid'] = $this
    ->uuidGenerator()
    ->generate();
  $this
    ->getReactions()
    ->addInstanceId($configuration['id'], $configuration);
  return $configuration['id'];
}