You are here

protected function ExecutionMetadataState::__construct in Rules 8.3

Constructs the object.

Parameters

\Drupal\Core\TypedData\DataDefinitionInterface[] $data_definitions: (optional) Data definitions to initialize this state with.

File

src/Context/ExecutionMetadataState.php, line 38

Class

ExecutionMetadataState
The state used during configuration time holding data definitions.

Namespace

Drupal\rules\Context

Code

protected function __construct(array $data_definitions) {
  $this->dataDefinitions = $data_definitions;

  // Add definitions of all global contexts.
  $contexts = $this
    ->getGlobalContextRepository()
    ->getAvailableContexts();
  foreach ($contexts as $name => $context) {
    $this
      ->setDataDefinition($name, $context
      ->getContextDefinition()
      ->getDataDefinition());
  }
}