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

klausi’s picture

Status: Active » Needs review

Pull 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.

  • klausi committed fa464ac on
    Issue #2453545: Allow execution expression containers with any defined...
klausi’s picture

Status: Needs review » Fixed

Merged 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.

fago’s picture

Looks good, great work!

fago’s picture

Title: Allow execution expression containers with any defined context » Complete expression containers with any defined context

hm, 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.