Fluid
Fluid copied to clipboard
Feature Request: null coalescing operator in inline fluid
I recently stumbled upon a fluid template that made me very sad and so I decided to improve it even more and after I was a little less sad I became a bit sadder nonetheless, because PHP has spoiled me with the null coalescing operator.
What I had:
<span><f:if condition="{model.field}"><f:then>{model.field}</f:then><f:else>Default</f:else></f:if>
What I hoped for:
<span>{model.field ?? 'Default'}</span>
It would be nice to have this feature in Fluid 3 (and even 2, but I guess we should slowly EOL it and push Fluid 3)
I also would welcome support for a null coalescing shorthand syntax
I started working on it, the reference tree is here:
https://github.com/CDRO/Fluid/tree/feature/nullcoalescing
It is still WIP, but I'll try to get it to work quickly so I can have it reviewed.
#572