Created
January 16, 2017 15:55
-
-
Save woutersf/a85168b75a00badea29c409d28ba612a to your computer and use it in GitHub Desktop.
drupal8 nested render array in table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$header = array(); | |
foreach ($programs->list as $program) { | |
$rows[] = array( | |
'img' => array( | |
'data' => array( | |
'#theme' => 'image', | |
'#attributes' => array( | |
'src' => $program->images[0]->url, //Images come from an external resources, otherwise use #uri on the level of #attributes | |
) | |
), | |
), | |
'other_field' => $program->name, | |
'programma' => 'more data', | |
); | |
} | |
return [ | |
'#type' => 'table', | |
'#header' => $header, | |
'#rows' => $rows, | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment