You need to implement this code in TWIG:
foreach ($list as $line){ foreach ($formatlist as $form){ if ($line[$form['var']]){ echo $line[$form['var']]; } else { echo 'none'; } } } How can I call a variable from a Twig key?
[non-working option], the problem is that line.form.var tries to work out like: $line['form']['var'];
And you need $line[$form['var']];
{% for line in list %} {% for form in formatlist %} {% if line.form.var %} {{line.form.var}} {% else %} none {% endif %} {% endfor %} {% endfor %} How can I correctly indicate the index for the output variable?