protected function AddExpressionForm::getEditedExpression in Rules 8.3
Gets the currently edited expression from the given component.
Parameters
\Drupal\rules\Engine\RulesComponent $component: The component from which to get the expression.
Return value
\Drupal\rules\Engine\ExpressionInterface|null The expression object.
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;
}
}