function RuleExpression::__construct
Constructs a new class instance.
Parameters
array $configuration: A configuration array containing information about the plugin instance.
string $plugin_id: The plugin_id for the plugin instance.
array $plugin_definition: The plugin implementation definition.
\Drupal\rules\Engine\ExpressionManagerInterface $expression_manager: The rules expression plugin manager.
\Drupal\Core\Logger\LoggerChannelInterface $logger: The Rules debug logger channel.
Overrides ExpressionBase::__construct
File
-
src/
Plugin/ RulesExpression/ RuleExpression.php, line 78
Class
- RuleExpression
- Provides a rule, executing actions when conditions are met.
Namespace
Drupal\rules\Plugin\RulesExpressionCode
public function __construct(array $configuration, $plugin_id, array $plugin_definition, ExpressionManagerInterface $expression_manager, LoggerChannelInterface $logger) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$configuration += [
'conditions' => [],
'actions' => [],
];
// Per default the outer condition container of a rule is initialized as
// conjunction (AND), meaning that all conditions in it must evaluate to
// TRUE to fire the actions.
$this->conditions = $expression_manager->createInstance('rules_and', $configuration['conditions']);
$this->conditions
->setRoot($this->getRoot());
$this->actions = $expression_manager->createInstance('rules_action_set', $configuration['actions']);
$this->actions
->setRoot($this->getRoot());
$this->expressionManager = $expression_manager;
$this->rulesDebugLogger = $logger;
}