function AddExpressionForm::getEditedExpression
Overrides EditExpressionForm::getEditedExpression
File
-
src/
Form/ AddExpressionForm.php, line 71
Class
- AddExpressionForm
- UI form to add an expression like a condition or action to a rule.
Namespace
Drupal\rules\FormCode
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;
}
}