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.

Comments

hawkeye.twolf created an issue. See original summary.

hawkeye.twolf’s picture

Status: Active » Needs review
StatusFileSize
new1.64 KB
hawkeye.twolf’s picture

StatusFileSize
new1.56 KB

Remove copy/paste comment.

hawkeye.twolf’s picture

Title: Support wrapper class variants for when a field has no value » Support wrapper class variants for when a field is empty
hawkeye.twolf’s picture

Issue summary: View changes
e0ipso’s picture

Thanks 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 FieldValueVariantCondition receives a NULL to 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 NULL to FieldValueVariantCondition.

Does that sound fair?

e0ipso’s picture

StatusFileSize
new5.48 KB

Patch updated implementing the suggestion in #6.

  • e0ipso committed f051074 on 3.x authored by hawkeye.twolf
    Issue #3172766 by hawkeye.twolf, e0ipso: Support wrapper class variants...
e0ipso’s picture

Status: Needs review » Fixed
e0ipso’s picture

Thanks for this!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.