From 53454451a84938723f399a4dd0ced569a5b9fa28 Mon Sep 17 00:00:00 2001 From: Silvio Date: Thu, 2 Aug 2012 17:14:28 -0300 Subject: Adding embed and image fields into the timeline --- timelinejs.module | 11 +++++------ timelinejs_json_event.tpl.php | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/timelinejs.module b/timelinejs.module index da6023f..2e79b4e 100644 --- a/timelinejs.module +++ b/timelinejs.module @@ -90,9 +90,9 @@ function timelinejs_load_events($nid) { */ function timelinejs_json($nid) { // Sanitization and basic data. - $nid = (int) $nid; - $node = node_load($nid); - $nodes = timelinejs_load_events($nid); + $nid = (int) $nid; + $timeline = node_load($nid); + $nodes = timelinejs_load_events($nid); foreach ($nodes as $node) { $items[] = node_load($node->entity_id); @@ -103,10 +103,9 @@ function timelinejs_json($nid) { $events = implode(',', $output); } - // TODO $text = $media = NULL; - $headline = $node->title; - $date = $node->field_data['und']['0']['value']; + $headline = $timeline->title; + $date = $timeline->field_data['und']['0']['value']; print theme('timelinejs_json', array( 'headline' => $headline, diff --git a/timelinejs_json_event.tpl.php b/timelinejs_json_event.tpl.php index a76f806..575017e 100644 --- a/timelinejs_json_event.tpl.php +++ b/timelinejs_json_event.tpl.php @@ -1,11 +1,21 @@ { - "startDate":"field_data['und']['0']['value'])); ?>", + "startDate":"field_data['und'][0]['value'])); ?>", "headline":"title; ?>", - "text":"body['und']['0']['value']; ?>", + "text":"body['und'][0]['value']; ?>", "asset": { - "media":"media; ?>", +field_embed)) { ?> + "media":"field_embed['und'][0]['uri']); ?>", "credit":"", "caption":"" +field_image)) { ?> + "media":"field_image['und'][0]['uri']); ?>", + "credit":"", + "caption":"" + + "media":"", + "credit":"", + "caption":"" + } } -- cgit v1.2.3