/** * {@inheritdoc} */ protected function getEditedExpression(RulesComponent $component) { $component_expression = $component->getExpression(); if (!$component_expression instanceof ExpressionContainerInterface) { throw new \LogicException('Cannot add expression to expression of type ' . $component_expression->getPluginId()); } if ($this->uuid && ($expression = $component_expression->getExpression($this->uuid))) { return $expression; } else { $expression = $this->expressionManager->createInstance($this->expressionId); $rule_expression = $component->getExpression(); $rule_expression->addExpressionObject($expression); return $expression; } }
/** * Sets the Rules component to be stored. * * @param \Drupal\rules\Engine\RulesComponent $component * The component. * * @return $this */ public function setComponent(\Drupal\rules\Engine\RulesComponent $component) { $this->setExpression($component->getExpression()); $this->setContextDefinitions($component->getContextDefinitions()); return $this; }
/** * Gets the currently edited expression from the given component. * * @param \Drupal\rules\Engine\RulesComponent $component * The component from which to get the expression. * * @return \Drupal\rules\Engine\ExpressionInterface|null * The expression object. */ protected function getEditedExpression(RulesComponent $component) { $rule_expression = $component->getExpression(); return $rule_expression->getExpression($this->uuid); }
/** * {@inheritdoc} */ public function updateFromComponent(RulesComponent $component) { // Note that the available context definitions stem from the configured // events, which are handled separately. $this->setExpression($component->getExpression()); return $this; }