summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2012-08-06 14:43:23 -0300
committerSilvio <silvio@socioambiental.org>2012-08-06 14:43:23 -0300
commitb4b9ad1ad0bfd7497bbd6224fc416c16eeb8189e (patch)
treeac692cb42e930958c7eee73632b7ccf6926593a0
parent21e6476365e83c28971e4a3a0c3e452ec32b799d (diff)
downloadtimelinejs-b4b9ad1ad0bfd7497bbd6224fc416c16eeb8189e.tar.gz
timelinejs-b4b9ad1ad0bfd7497bbd6224fc416c16eeb8189e.tar.bz2
Default entry when the timeline is empty
-rw-r--r--timelinejs.module7
1 files changed, 7 insertions, 0 deletions
diff --git a/timelinejs.module b/timelinejs.module
index 5d3ce9f..9c61b88 100644
--- a/timelinejs.module
+++ b/timelinejs.module
@@ -92,6 +92,13 @@ function timelinejs_json($nid) {
$items[] = node_load($node->entity_id);
}
+ if (empty($items)) {
+ $items[0] = new stdClass();
+ $items[0]->field_date['und'][0]['value'] = NULL;
+ $items[0]->title = t('No items');
+ $items[0]->body['und'][0]['value'] = t('Currently there are new items in this timeline');
+ }
+
foreach ($items as $event) {
$output[] = theme('timelinejs_json_event', array('event' => $event));
$events = implode(',', $output);