Problem/Motivation

When using a token in a condition and the token cannot be replaced for whatever reason, the condition will use the name of the token (e.g. [my-random-token]). This is particularly problematic for users selecting the "Check if value is empty" option because such tokens will never evaluate to empty even if the corresponding field/attribute/etc. has no value. It is possible to work around this for certain fields by saying "[my-random-token] == [my-random-token]" instead of "[my-random-token] is empty," but that is unintuitive.

Proposed resolution

If no value is generated for a given token, replace it with an empty string. The core token replace method provides a simple "clear" option to achieve this.

Remaining tasks

Patch. Test. Discuss side effects.

User interface changes

Replace "@todo Add description" with a description of the "check if value is empty" behavior.

API changes

None

Data model changes

None.

Comments

ndewhurst created an issue. See original summary.

ndewhurst’s picture

Assigned: ndewhurst » Unassigned
Status: Active » Needs review
StatusFileSize
new1.43 KB

Here is a patch that clears irreplaceable tokens instead of leaving their names in the strings. It applies to both the token string and the compared value string if applicable. I also added a description to the checkbox. Does this raise any concerns for other module users?

manuel.adan’s picture

The clear option in token replacement is certainly mandatory here. Patch didn't apply cleanly because of recent changes. Re-rolled with minor changes in the provided description text according to new field names. Thanks!

  • manuel.adan committed 84824ca on 8.x-1.x
    Issue #2974582 by ndewhurst, manuel.adan: Better "Is Empty" Support
    
manuel.adan’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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