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');
|
0, 3500), ENT_XML1, 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['audio'] = array();
|
|
||||||
$first = true;
|
$first = true;
|
||||||
foreach($nodes_e as $nid => $node) {
|
foreach($nodes_e as $nid => $node) {
|
||||||
$data['audio'][$nid] = array();
|
$data['nodes'][$nid]['audio'] = array();
|
||||||
foreach( $node->get('field_contenuti_audio')->referencedEntities() as $ai => $audio) {
|
$data['nodes'][$nid]['img'] = array();
|
||||||
// print_r(get_class_methods(get_class($audio)));
|
foreach( $node->get('field_contenuti_audio')->referencedEntities() as $ai => $entity) {
|
||||||
$data['audio'][$nid][$ai] = $audio->toArray();
|
$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) {
|
if($first === true) {
|
||||||
|
// print_r($data['nodes'][$nid]['img']);
|
||||||
$first = false;
|
$first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
<itunes:category text="News & Politics"/>
|
<itunes:category text="News & Politics"/>
|
||||||
|
|
||||||
{% for nid, node in ror.podcast.nodes %}
|
{% for nid, node in ror.podcast.nodes %}
|
||||||
{% set num_audios = ror.podcast.audio[nid]|length %}
|
{% set num_audios = node.audio|length %}
|
||||||
{% for num, audio in ror.podcast.audio[nid] %}
|
{% for num, audio in node.audio %}
|
||||||
<item>
|
<item>
|
||||||
{% set audiourl = audio.field_audio_link[0].uri %}
|
{% set audiourl = audio.field_audio_link[0].uri %}
|
||||||
{% set ext = audiourl|split('.')|last %}
|
{% set ext = audiourl|split('.')|last %}
|
||||||
|
@ -32,7 +32,13 @@
|
||||||
<title> {{node.title.0.value}} </title>
|
<title> {{node.title.0.value}} </title>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<itunes:summary>{{ node.summary | raw }}</itunes:summary>
|
<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>
|
<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>
|
<enclosure url="{{ audiourl | replace({"https://": "http://"}) | escape('html_attr') }}" type="audio/{{ext}}" length="1024"></enclosure>
|
||||||
|
@ -43,11 +49,6 @@
|
||||||
<guid>{{ audiourl }}</guid>
|
<guid>{{ audiourl }}</guid>
|
||||||
</item>
|
</item>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{# [fields]
|
|
||||||
{% for field in node.getFields() %}
|
|
||||||
[[ {{ field.getName() }} ]]
|
|
||||||
{% endfor %}
|
|
||||||
[/fields] #}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
</channel>
|
</channel>
|
||||||
|
|
Loading…
Reference in a new issue