The null coalescing operator in Antlers behaves differently than in PHP land. It checks for truthy values, rather than for strict null. Most of the time, that's perfectly fine and desired, but sometimes I really want to keep an empty string.
For example, <input type="text" value="{{ old.shipping_line_2 ?? 'Fallback' }}" /> in a form, when many fields were submitted and old.shipping_line_2 was submitted empty, I want to keep the empty value.
In Discord, @andjsch had the idea of a strict ??? operator in Antlers that does what PHP does.
The null coalescing operator in Antlers behaves differently than in PHP land. It checks for truthy values, rather than for strict
null. Most of the time, that's perfectly fine and desired, but sometimes I really want to keep an empty string.For example,
<input type="text" value="{{ old.shipping_line_2 ?? 'Fallback' }}" />in a form, when many fields were submitted andold.shipping_line_2was submitted empty, I want to keep the empty value.In Discord, @andjsch had the idea of a strict
???operator in Antlers that does what PHP does.