Problem/Motivation
I'd like to change the wrapper class when a given field on the wrapped entity is empty.
Steps to reproduce
Try setting NULL as the field value on a regular FieldValueVariantCondition, and see that it doesn't match when the field has no value (probably as expected).
Proposed resolution
Create a new variant condition, EmptyFieldVariantCondition
Remaining tasks
Upload patch.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 3172766--empty-field-variant-condition--7.patch | 5.48 KB | e0ipso |
Comments
Comment #2
hawkeye.twolfComment #3
hawkeye.twolfRemove copy/paste comment.
Comment #4
hawkeye.twolfComment #5
hawkeye.twolfComment #6
e0ipsoThanks for the patch! I will merge this onto 3.x.
However, I think that it would be fair to also have special handling for the case when the
FieldValueVariantConditionreceives aNULLto check if it's empty. This is in line with the principle of least astonishment, given that this is what you tried first and didn't work.After the patch there should be 2 ways of using a variant when a field is empty, using the new condition, or passing
NULLtoFieldValueVariantCondition.Does that sound fair?
Comment #7
e0ipsoPatch updated implementing the suggestion in #6.
Comment #9
e0ipsoComment #10
e0ipsoThanks for this!