You are here

public function RulesComponentConfig::setProvidedContextDefinitions in Rules 8.3

Sets the definitions of the provided 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 207

Class

RulesComponentConfig
Rules component configuration entity to persistently store configuration.

Namespace

Drupal\rules\Entity

Code

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