Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
klausiHm, 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?
Comment #2
klausiclarifiying.
Comment #3
klausiComment #4
klausiStarting work at https://github.com/fago/rules/pull/387
Comment #5
klausiReady for review!
Comment #6
fagothanks. I generally like how this works - seems like the approach works out fine :)
I added a few remarks and/or thoughts to the PR.
Comment #7
klausiFixed most of your comments and replied where I think we should leave it as is.
Ready for review!
Comment #9
klausimerged.
Comment #11
fagohm, good that we have that now, but it seems to be totally unused still?
Comment #12
fagoI 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.
Comment #13
fagoI completed that in #2677034: Context is not refined when checking integrity.