This:
global $language;
$json_source = '/_timelinejs/' . $view->name . '/' . $view->current_display;
if(is_array($view->args)) {
$json_source .= '/' . implode('/', $view->args);
}
$settings = array(
'width' => '100%',
'height' => '500',
'source' => $json_source,
'embed_id' => $timelinejs_id,
'lang' => $language->language,
);
// Include TimelineJS libraries
views_timelinejs_load_libraries();
// Include inline javascript
drupal_add_js(array('timelineJS' => $settings), 'setting');
drupal_add_js(drupal_get_path('module', 'views_timelinejs') . '/js/views_timelinejs.js');shouldn't be in the tpl file, but in the module.
Comments
Comment #1
juhaniemi commentedMoved PHP code from .tpl.php to preprocess function as a part of a bigger change. Thanks for the heads-up!