How to pull out Twig variables? 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:

&lt;b&gt;$ {{transaction.amount }}&lt;/b&gt; total donation&lt;br/&gt;&lt;br/&gt;


and   

&lt;b&gt;$ {{transaction[0].amount }}&lt;/b&gt; total donation&lt;br/&gt;&lt;br/&gt;


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' =&gt; array(
      'variables' =&gt; array(
        'transaction' =&gt; NULL,
      ),
       'template' =&gt; 'touchdownclubtransaction',
    ),
  );
}
I looked at some other modules controllers and saw that in the controller they used 

$result = db_query    
$output = $result-&gt;fetchAll();


Before pushing the code to the return array. I tried it and it worked for me like it should. Problem solved.