Closed (fixed)
Project:
Rules
Version:
8.x-3.x-dev
Component:
Rules Core
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
27 Feb 2016 at 11:12 UTC
Updated:
15 Mar 2016 at 14:14 UTC
Jump to comment: Most recent
Right now, conditions like the following cannot be completed as we miss the API for contextual plugins to fetch metadata of configured context:
#2281079: Port "Data comparison (data_is)" condition to 8.x
#2281083: Port "List contains item (list_contains)" condition to 8.x
Comments
Comment #2
fagoComment #3
fagoI think we could do this best by passing the array of mapped context definitions to refineContextDefinitions(). That way we keep the contextual plugins free of a dependency on the [metadata] execution state.
Comment #4
fagoImplemented #2677034: Context is not refined when checking integrity - so we see where refineContextDefinitions() is called. Prepared \Drupal\rules\Context\ContextHandlerTrait::getMappedDefinition() so this should be straight-forward now.
Comment #5
fagook, I implemented this and add test-coverage for it. I used the Data comparison condition as example, thus included the fix for here.
For being able to solve that cleanly I had to separate prepareContextWithMetadata() from pepareContext(). It's partly duplication the run-time logic now, but the duplicating part is very small. We could make both methods re-use more codes by making even more re-used small helper methods but I do not think that helps a lot, given the many small differences. Moreover, this is probably a quite performance critical path so not having that many useless function calls in there cannot harm.
PR: https://github.com/fago/rules/pull/424 - building upon #2677034: Context is not refined when checking integrity.
Comment #7
fagoMerged.