public function RuleExpression::addExpression in Rules 8.3
Creates and adds an expression.
Parameters
string $plugin_id: The id of the expression plugin to add.
\Drupal\rules\Context\ContextConfig $config: (optional) The configuration for the specified plugin.
Return value
$this
Throws
\Drupal\rules\Exception\InvalidExpressionException Thrown if the wrong expression is passed; e.g. if a condition expression is added to an action expression container.
Overrides ExpressionContainerInterface::addExpression
File
- src/
Plugin/ RulesExpression/ RuleExpression.php, line 192
Class
- RuleExpression
- Provides a rule, executing actions when conditions are met.
Namespace
Drupal\rules\Plugin\RulesExpressionCode
public function addExpression($plugin_id, ContextConfig $config = NULL) {
return $this
->addExpressionObject($this->expressionManager
->createInstance($plugin_id, $config ? $config
->toArray() : []));
}