I am trying to get my first module to work which is supposed to render an array in his own template file.
1) I got an array of variables and return it in my controller
array( '#theme' => 'myTheme', '#test_var' => $this->t('Test Value'), '#array' => array('key'=>$myArray), ); 2) in my .module I declare the hook_theme()
return array( 'myTheme' => array( 'variables' => array( 'test_var' => '', 'array' => array(), ), ), );
3) Then I would like to print the variables I am sure I missing something, and if I'm missing basic knowledge please let me know. I'm sure something is wrong in the hook_theme since I don't know how to iterate my array in the template file.
<p>test_var: {{ test_var }}</p> <p>{{ array }}</p> If somebody could point me in the right direction, that would be nice :)
edit: the "Test Value" is rendering just fine