function ContextDefinition::__construct

Same name in this branch
  1. 8.x-3.x src/Context/ContextDefinition.php \Drupal\rules\Context\ContextDefinition::__construct()

Overrides ContextDefinition::__construct

File

src/Context/Annotation/ContextDefinition.php, line 31

Class

ContextDefinition
Extends the core context definition annotation object for Rules.

Namespace

Drupal\rules\Context\Annotation

Code

public function __construct(array $values) {
    // Filter out any @Translation annotation objects.
    foreach ($values as $key => $value) {
        if ($value instanceof Translation) {
            $values[$key] = $value->get();
        }
    }
    $this->definition = RulesContextDefinition::createFromArray($values);
}