I have some variables in twig like
placeholder1
placeholder2
placeholderx
To call them, I am looping through the array of objects "invoices"
{% for invoices as invoice %}
need to display here the placeholder followed by the invoice id number
{{ placeholedr1 }}
I just had the same issue - and using this first answer and after some additional research found the {{ attribute(_context, 'placeholder'~invoice.id) }}
should work (_context
being the global context object containing all objects by name)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With