You are here

public function RulesComponentConfig::setContextDefinitions in Rules 8.3

Sets the definitions of the used context.

Parameters

\Drupal\rules\Context\ContextDefinitionInterface[] $definitions: The array of context definitions, keyed by context name.

Return value

$this

File

src/Entity/RulesComponentConfig.php, line 175

Class

RulesComponentConfig
Rules component configuration entity to persistently store configuration.

Namespace

Drupal\rules\Entity

Code

public function setContextDefinitions(array $definitions) {
  $this->component['context_definitions'] = [];
  foreach ($definitions as $name => $definition) {
    $this->component['context_definitions'][$name] = $definition
      ->toArray();
  }
  return $this;
}