Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: null coalescing operator in inline fluid #522

Open
CDRO opened this issue Sep 2, 2020 · 3 comments
Open

Feature Request: null coalescing operator in inline fluid #522

CDRO opened this issue Sep 2, 2020 · 3 comments

Comments

@CDRO
Copy link

CDRO commented Sep 2, 2020

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)

@da-anda
Copy link

da-anda commented Oct 26, 2021

I also would welcome support for a null coalescing shorthand syntax

@CDRO
Copy link
Author

CDRO commented Oct 26, 2021

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.

@s2b
Copy link
Contributor

s2b commented Nov 24, 2023

#572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants