Trying to use some Twig variables (simple strings) in a template that I created from a custom module. Using the Devel and Kint modules I can see the info under Iterator contents with:
{{kint(transaction[0])}}
I just can't get the template to print it out on the page.
I tried this:
<b>$ {{transaction.amount }}</b> total donation<br/><br/>
and
<b>$ {{transaction[0].amount }}</b> total donation<br/><br/>
Either way comes up empty. Not sure what I'm missing here. It works in other modules just fine. Maybe I'm too high on the Twig templates? I don't understand the tree structure very well. I created a template called transaction.html.twig
.
This is what my controller looks like.
This is the .module file. It's passing over from the controller to this theme which then passes it to the twig file. At least this is how all the tutorials tell me to do it. I create this same thing on another module and it works fine.
function touchdownclub_theme($existing, $type, $theme, $path) {
return array(
'touchdownclubtransaction' => array(
'variables' => array(
'transaction' => NULL,
),
'template' => 'touchdownclubtransaction',
),
);
}
{{ kint(transaction[0].value) }}
? – No Sssweat Jan 16 '19 at 21:23