Closed (fixed)
Project:
Rules
Version:
8.x-3.x-dev
Component:
Rules Core
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
16 Mar 2015 at 23:22 UTC
Updated:
21 Jun 2015 at 13:14 UTC
Jump to comment: Most recent
Right now, only the Rule class has the possibility hard-coded to work with pre-defined context. It has the following wrong comment:
// @todo: This needs to be removed again and we need to add proper derivative handling for Rules.
if (isset($configuration['context'])) {
$plugin_definition['context'] = $this->createContextDefinitions($configuration['context_definitions']);
}This needs to be solved and generalized to all expression containers, such that it works with ors, ands and action sets.
Comments
Comment #1
klausiPull request: https://github.com/fago/rules/pull/193
I did a bit of refactoring and finally separated RulesActionInterface and ActionExpressionInterface.
RulesActionInterface: for actual action plugins, example: EntityDelete.php
ActionExpressionInterface: for the expression plugins that execute something. Example: Rule.php, ActionSet.php, RulesAction.php
Then I created a new abstract base class: ExpressionBase.php. It contains the code to create context definitions from plugin configuration. Example: You want to define an action set that receives a node as context, then you specify the node as data type in "context_definitions" of the action set.
Comment #3
klausiMerged because I want to continue on this when I look at implementing Rules events. Let's open follow-ups if there is anything missing or unclear.
Comment #4
fagoLooks good, great work!
Comment #5
fagohm, I think we need some test coverage for this though. There are no integration tests for our expression in general. I think we should one integration test per plugin that also covers running it with custom context definitions. But that depends highly on #2501927: Separate component handling code from Rules expressions.