Answer the question
In order to leave comments, you need to log in
How to do the correct interpolation in twig with a ternary condition?
I have an input and the following condition:
The variable {{ value }} stores the value
{% set text = ( key_value != 'address' ? 'value="{{ value }}"' : '' ) %}
<input type="text" name="" {{ text }} class="" id="">
Answer the question
In order to leave comments, you need to log in
{% set text = ( key_value_cse != 'cse_address_street' ? ('value="' ~ value ~ '"') : '' ) %}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question