summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--timelinejs.module7
-rw-r--r--timelinejs_json.tpl.php29
-rw-r--r--timelinejs_json_event.tpl.php29
3 files changed, 33 insertions, 32 deletions
diff --git a/timelinejs.module b/timelinejs.module
index 9ae7f80..33020ed 100644
--- a/timelinejs.module
+++ b/timelinejs.module
@@ -105,14 +105,15 @@ function timelinejs_load_events($nid) {
/**
* Menu callback.
- *
- * @todo
*/
function timelinejs_json($nid) {
// Sanitization and basic data.
$nid = (int) $nid;
$nodes = timelinejs_load_events($nid);
- $items = array();
+
+ foreach ($nodes as $node) {
+ $items[] = node_load($node->entity_id);
+ }
foreach ($items as $event) {
$events[] = theme('timelinejs_json_event', array('event' => $event));
diff --git a/timelinejs_json.tpl.php b/timelinejs_json.tpl.php
index 2e69e8d..92ac391 100644
--- a/timelinejs_json.tpl.php
+++ b/timelinejs_json.tpl.php
@@ -1,11 +1,18 @@
- {
- "startDate":"<?php print $event['date']; ?>",
- "headline":"<?php print $event['headline']; ?>",
- "text":"<?php print $event['text']; ?>",
- "asset":
- {
- "media":"<?php print $event['media']; ?>",
- "credit":"",
- "caption":""
- }
- }
+{
+ "timeline":
+ {
+ "headline":"<?php print $headline; ?>",
+ "type":"default",
+ "startDate":"<?php print $date; ?>",
+ "text":"<?php print $text; ?>",
+ "asset":
+ {
+ "media":"<?php print $media; ?>",
+ "credit":"",
+ "caption":""
+ },
+ "date": [
+<?php print $events; ?>
+ ]
+ }
+}
diff --git a/timelinejs_json_event.tpl.php b/timelinejs_json_event.tpl.php
index 92ac391..2e69e8d 100644
--- a/timelinejs_json_event.tpl.php
+++ b/timelinejs_json_event.tpl.php
@@ -1,18 +1,11 @@
-{
- "timeline":
- {
- "headline":"<?php print $headline; ?>",
- "type":"default",
- "startDate":"<?php print $date; ?>",
- "text":"<?php print $text; ?>",
- "asset":
- {
- "media":"<?php print $media; ?>",
- "credit":"",
- "caption":""
- },
- "date": [
-<?php print $events; ?>
- ]
- }
-}
+ {
+ "startDate":"<?php print $event['date']; ?>",
+ "headline":"<?php print $event['headline']; ?>",
+ "text":"<?php print $event['text']; ?>",
+ "asset":
+ {
+ "media":"<?php print $event['media']; ?>",
+ "credit":"",
+ "caption":""
+ }
+ }