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.
Problem/Motivation
Currently there's a "entity has field" condition but none like "entity has property".
Such a condition could become very handy if you want to create very generic rules to handle entities of different types / bundles.
Proposed resolution
Re-use rules_condition_entity_has_field()
and just provide an additional condition definition that doesn't limit the selection to fields. That's all everything else is already in place.
Btw. it would be nice to be able to assert multiple fields / property per condition as this would increase the speed of creating rules.
Remaining tasks
Reviews needed.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#1 | rules-add-property-condition-2418365-1-test-only.patch | 1.08 KB | das-peter |
#1 | rules-add-property-condition-2418365-1.patch | 2.14 KB | das-peter |
Comments
Comment #1
das-peter CreditAttribution: das-peter commentedTried to add a test freehand. Let's see if this works. Test only patch is supposed to fail, the other not.
Comment #4
TR CreditAttribution: TR commentedWhile this feature may be useful, there has been NO ONE in the community who has been willing to devote even a minimal amount of effort to test or improve this patch over the past five years. So I don't think it's worth my while to spend any of my 100% volunteer time to get this patch to work and to add tests and to commit it to D7 Rules.
If you would like to see this feature implemented, please open a new issue WITH A PATCH and be prepared to follow-up on any questions/concerns raised when you post that patch.