/** * Sets a Rules expression instance for this Rules component. * * @param \Drupal\rules\Engine\ExpressionInterface $expression * The expression to set. * * @return $this */ public function setExpression(ExpressionInterface $expression) { $this->expression = $expression; $this->expression_id = $expression->getPluginId(); $this->configuration = $expression->getConfiguration(); return $this; }
/** * Gets the configuration array of this component. * * @return array * The configuration of this component. It contains the following keys: * - expression: The configuration of the contained expression, including a * nested 'id' key. * - context_definitions: Array of context definition arrays, keyed by * context name. * - provided_context: The names of the context that is provided back. */ public function getConfiguration() { return ['expression' => $this->expression->getConfiguration(), 'context_definitions' => array_map(function (ContextDefinitionInterface $definition) { return $definition->toArray(); }, $this->contextDefinitions), 'provided_context_definitions' => $this->providedContext]; }
/** * Sets a Rules expression instance for this Rules component. * * @param \Drupal\rules\Engine\ExpressionInterface $expression * The expression to set. * * @return $this */ public function setExpression(ExpressionInterface $expression) { $this->component['expression'] = $expression->getConfiguration(); unset($this->componentObject); return $this; }
/** * Sets a Rules expression instance for this Reaction rule. * * @param \Drupal\rules\Engine\ExpressionInterface $expression * The expression to set. * * @return $this */ public function setExpression(ExpressionInterface $expression) { $this->expressionObject = $expression; $this->expression = $expression->getConfiguration(); return $this; }