diff options
author | Silvio <silvio@socioambiental.org> | 2012-08-01 16:08:59 -0300 |
---|---|---|
committer | Silvio <silvio@socioambiental.org> | 2012-08-01 16:08:59 -0300 |
commit | a820ecec5069f6670fc3ea45c29657390668e1f5 (patch) | |
tree | 7c3902f1af90a91078da5d57a67359d394d0706f /timelinejs.module | |
parent | 149097510754e175ab93fc9fa8844999713269fb (diff) | |
download | timelinejs-a820ecec5069f6670fc3ea45c29657390668e1f5.tar.gz timelinejs-a820ecec5069f6670fc3ea45c29657390668e1f5.tar.bz2 |
Adding timeline output to full node view
Diffstat (limited to 'timelinejs.module')
-rw-r--r-- | timelinejs.module | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/timelinejs.module b/timelinejs.module index c42397d..a49c04f 100644 --- a/timelinejs.module +++ b/timelinejs.module @@ -25,15 +25,20 @@ function timelinejs_field_info() { /** * Implements hook_node_view(). - * - * @todo */ function timelinejs_node_view($node, $view_mode, $langcode) { if ($node->type == 'timeline' && $view_mode == 'full') { + $node->content['timeline']['#markup'] = timelinejs($node->nid); } } /** + * Implements hook_node_view_alter. + */ +function timelinejs_node_view_alter(&$build) { +} + +/** * Implements hook_menu() */ function timelinejs_menu() { @@ -59,11 +64,20 @@ function timelinejs_theme($existing, $type, $theme, $path) { return array( 'timelinejs' => array( 'template' => 'timelinejs', - 'variables' => array('timeline'), + 'variables' => array( + 'width' => NULL, + 'height' => NULL, + 'source' => NULL, + 'start_at_end' => 'false', + 'hash_bookmark' => 'true', + 'css' => NULL, + 'js' => '/sites/all/libraries/timelinejs/compiled/js/timeline.js', + 'lang' => '/sites/all/libraries/timelinejs/compiled/js/locale/pt-br.js', + ), ), 'timelinejs_json' => array( 'template' => 'timelinejs_json', - 'variables' => array('timeline'), + 'variables' => array('headline', 'date', 'text', 'media', 'events'), ), ); } @@ -95,8 +109,15 @@ function timelinejs_json($nid) { $nid = (int) $nid; $events = timelinejs_load_events($nid); + print theme('timelinejs_json', array( + 'headline' => $headline, + 'date' => $date, + 'text' => $text, + 'media' => $media, + 'events' => array(), + )); + # Avoid themable output. - print theme('timelinejs', array('timeline' => array())); exit; } @@ -105,5 +126,11 @@ function timelinejs_json($nid) { * * @todo */ -function timelinejs($path) { +function timelinejs($nid) { + return theme('timelinejs', array( + 'width' => '960px', + 'height' => '500px', + 'source' => '/sites/boletim/files/timeline-saude-indigena_2.json', + 'css' => '/sites/boletim/themes/boletimclean/timeline.css' + )); } |