diff --git a/src/Controller/PodcastRorController.php b/src/Controller/PodcastRorController.php index 1341092..26d14bc 100644 --- a/src/Controller/PodcastRorController.php +++ b/src/Controller/PodcastRorController.php @@ -42,15 +42,22 @@ class PodcastRorController extends ControllerBase { 0, 3500), ENT_XML1, 'UTF-8'); } - $data['audio'] = array(); $first = true; foreach($nodes_e as $nid => $node) { - $data['audio'][$nid] = array(); - foreach( $node->get('field_contenuti_audio')->referencedEntities() as $ai => $audio) { - // print_r(get_class_methods(get_class($audio))); - $data['audio'][$nid][$ai] = $audio->toArray(); + $data['nodes'][$nid]['audio'] = array(); + $data['nodes'][$nid]['img'] = array(); + foreach( $node->get('field_contenuti_audio')->referencedEntities() as $ai => $entity) { + $data['nodes'][$nid]['audio'][$ai] = $entity->toArray(); + } + foreach( $node->get('field_image')->referencedEntities() as $ai => $entity) { + $arr = $entity->toArray(); + $data['nodes'][$nid]['img'][] = array( + 'uri' => file_create_url($arr['uri'][0]['value']), + // 'raw' => $arr, + ); } if($first === true) { + // print_r($data['nodes'][$nid]['img']); $first = false; } } diff --git a/templates/podcast.html.twig b/templates/podcast.html.twig index ed88c84..29cabd5 100644 --- a/templates/podcast.html.twig +++ b/templates/podcast.html.twig @@ -18,8 +18,8 @@ {% for nid, node in ror.podcast.nodes %} - {% set num_audios = ror.podcast.audio[nid]|length %} - {% for num, audio in ror.podcast.audio[nid] %} + {% set num_audios = node.audio|length %} + {% for num, audio in node.audio %} {% set audiourl = audio.field_audio_link[0].uri %} {% set ext = audiourl|split('.')|last %} @@ -32,7 +32,13 @@ {{node.title.0.value}} {% endif %} {{ node.summary | raw }} - {{ node.body.0.value }} + {{ node.body.0.value }} + {# [fields] + {% for field in node.img.0|keys %} + [[ {{ field}}{{"\t"}}-> `{{node.img.0[field]}}` ]] + {% endfor %} + [/fields] #} + http://www.ondarossa.info{{node.path.0.alias}} @@ -43,11 +49,6 @@ {{ audiourl }} {% endfor %} - {# [fields] - {% for field in node.getFields() %} - [[ {{ field.getName() }} ]] - {% endfor %} - [/fields] #} {% endfor %}