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.
Look at the Drupal\node\Plugin\Condition\NodeType class (a core condition) and Drupal\condition\Tests\Condition\NodeConditionTest.
Compared to the core NodeType condition, we do not use configuration or configuration forms yet, but specify all parameters as context for now, as the form stuff is still to be figured out.
I went with a simpler implementation following the example of other conditions: https://github.com/fago/rules/pull/29. Happy to go with the way @omissis did it, I just need to understand the difference - which way thing are done best.
Comments
Comment #1
omissis CreditAttribution: omissis commentedComment #2
omissis CreditAttribution: omissis commentedLook at the Drupal\node\Plugin\Condition\NodeType class (a core condition) and Drupal\condition\Tests\Condition\NodeConditionTest.
Compared to the core NodeType condition, we do not use configuration or configuration forms yet, but specify all parameters as context for now, as the form stuff is still to be figured out.
Comment #3
fagoimproving title
Comment #4
omissis CreditAttribution: omissis commentedImplemented in https://github.com/fago/rules/pull/6
Comment #5
omissis CreditAttribution: omissis commentedComment #6
fagoThanks. Setting to needs work as you are still working on the tests.
Comment #7
paranojik CreditAttribution: paranojik commentedI went with a simpler implementation following the example of other conditions: https://github.com/fago/rules/pull/29. Happy to go with the way @omissis did it, I just need to understand the difference - which way thing are done best.
Comment #8
fubhy CreditAttribution: fubhy commented