Timeline for Passing an array of object from custom module to template in drupal 8
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 4, 2017 at 14:43 | comment | added | Ajay Reddy | @edwardchiapet given correct explanation, thanks edwardchiapet | |
Apr 4, 2017 at 14:00 | comment | added | edwardchiapet |
@UgyAstro - You don't need 'key' because when you do the for loop in the Twig, it will automatically associate the index with key and each element in the array with value . In your example, the key index variable will be the 'key' string and the value will be the actual array of objects.
|
|
Apr 4, 2017 at 12:57 | comment | added | Ugy Astro |
Thank's @AAjay Reddy, finally it works. If you are willing, can you give an explain why #myvariable => array('key' => $myArrayofObjects), changed to #myvariable => $myArrayofObjects ? For my knowladge. Thanks
|
|
Apr 4, 2017 at 10:35 | history | answered | Ajay Reddy | CC BY-SA 3.0 |