During the configuration of a rule certain expression plugins and actions need to add variables to the execution metadata state. That enables other things to know which variables in the state are available at a certain expression for example.

As figured out during https://www.drupal.org/node/2317193#comment-10000039, it's not possible right not to derive information about some configured context (via a data selector). However, we need to be able to do so such that plugins are able to refine the context based upon that.

Comments

klausi’s picture

Hm, not sure where to start here. As I understand it the goal is that if I have configured the "Content is of type" condition then conditions coming after that must have all fields available for the configured content type. So this issue should implement the metadata assertions?

In what form do we provide those assertions? There will probably be a method on the plugin class, like we have "refineContextDefinitions" now. What is passed to that method? Type data objects? Or the execution state? Or some configuration state?

How will we return the assertions? As nested arrays that represent properties/fields like in Drupal 7 Rules?

Maybe we should start with the data selector autocomplete implementation in the UI so that we have a feeling what is needed there in terms of assertions/restrictions/additions?

klausi’s picture

Title: Support fetching metadata of some configured context » Prepare execution metadata state for an expression in the tree
Issue summary: View changes

clarifiying.

klausi’s picture

Issue summary: View changes
klausi’s picture

klausi’s picture

Status: Active » Needs review

Ready for review!

fago’s picture

Status: Needs review » Needs work

thanks. I generally like how this works - seems like the approach works out fine :)
I added a few remarks and/or thoughts to the PR.

klausi’s picture

Status: Needs work » Needs review

Fixed most of your comments and replied where I think we should leave it as is.

Ready for review!

  • klausi committed e498278 on
    Issue #2501939: Implemented Preparing execution metadata state for an...
klausi’s picture

Status: Needs review » Fixed

merged.

Status: Fixed » Closed (fixed)

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

fago’s picture

hm, good that we have that now, but it seems to be totally unused still?

fago’s picture

I think what this missed is the actual implementation of #2677046: Integrity check does not validate set context values. opened #2677026: [META] Make refining context and checking integrity work for making all those things work.

fago’s picture