refactor data: audio and img inside nodes
This commit is contained in:
parent
e6ead3ce8f
commit
0d75617d86
2 changed files with 21 additions and 13 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
<itunes:category text="News & Politics"/>
|
||||
|
||||
{% 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 %}
|
||||
<item>
|
||||
{% set audiourl = audio.field_audio_link[0].uri %}
|
||||
{% set ext = audiourl|split('.')|last %}
|
||||
|
@ -32,7 +32,13 @@
|
|||
<title> {{node.title.0.value}} </title>
|
||||
{% endif %}
|
||||
<itunes:summary>{{ node.summary | raw }}</itunes:summary>
|
||||
<description> {{ node.body.0.value }} </description>
|
||||
<description> {{ node.body.0.value }}
|
||||
{# [fields]
|
||||
{% for field in node.img.0|keys %}
|
||||
[[ {{ field}}{{"\t"}}-> `{{node.img.0[field]}}` ]]
|
||||
{% endfor %}
|
||||
[/fields] #}
|
||||
</description>
|
||||
<link>http://www.ondarossa.info{{node.path.0.alias}}</link>
|
||||
|
||||
<enclosure url="{{ audiourl | replace({"https://": "http://"}) | escape('html_attr') }}" type="audio/{{ext}}" length="1024"></enclosure>
|
||||
|
@ -43,11 +49,6 @@
|
|||
<guid>{{ audiourl }}</guid>
|
||||
</item>
|
||||
{% endfor %}
|
||||
{# [fields]
|
||||
{% for field in node.getFields() %}
|
||||
[[ {{ field.getName() }} ]]
|
||||
{% endfor %}
|
||||
[/fields] #}
|
||||
{% endfor %}
|
||||
|
||||
</channel>
|
||||
|
|
Loading…
Reference in a new issue