I'm facing an issue in the following code
<div class="panel-icon {f:if(condition: '{0:panel.id}=={0:123}', then: 'icon-update', else: 'icon-{icon}')}"></div>
Currently the above code check if the panel.id
equals to 123
then apply the icon-update
to css class else whatever the icon being passed through {icon}
it works fine, but my requirement is I have 3 different panel.id
and if any of those panel id's have passed, then the icon-update
should be applied.
These are the approches I tried, but they're not working for me
Approach 1
<div class="panel-icon {f:if(condition: '{0:panel.id}=={0:123,0:456,0:789}', then: 'icon-update', else: 'icon-{icon}')}"></div>
Approach 2
<div class="panel-icon {f:if(condition: '{0:panel.id, 1:panel.id, 2:panel.id}=={0:123, 1:456, 2:789}', then: 'icon-update', else: 'icon-{icon}')}"></div>
I was tyring to find a clean solution for this, but still no luck. Any typo3 expert there to fix this issue?
I found the answer by myself for my question and I'm posting it here if anyone looking for a solution like me
<v:if stack="{0:panel.id, 1:'==', 2:'123', 3:'||', 4:panel.id, 5: '==', 6:'456', 7:'||', 8:panel.id, 9:'==', 10:'789'}">
<f:then><div class="icon icon-update"></div></f:then>
<f:else><div class="icon icon-{icon}"></div></f:else>
</v:if>
This solved my problem
Duplicates question TYPO3 Fluid complex if conditions - take a look at the answers there which contain updated examples.