View source
<?php
function nivo_slider_views_api() {
return array(
'api' => 2,
);
}
function template_preprocess_views_view_nivo_slider(&$vars) {
drupal_add_css(libraries_get_path('nivoslider') . '/nivo-slider.css');
drupal_add_css(drupal_get_path('module', 'nivo_slider') . '/nivo_slider.css');
drupal_add_js(libraries_get_path('nivoslider') . '/jquery.nivo.slider.pack.js');
$view = $vars['view'];
$options = $view->style_plugin->options;
$vars['nivo_slider_id'] = 'nivo-slider-' . $view->name . '-' . $view->current_display;
$view_settings['effect'] = check_plain($options['effect']);
$view_settings['slices'] = check_plain($options['slices']);
$view_settings['animSpeed'] = check_plain($options['animSpeed']) * 1000;
$view_settings['pauseTime'] = check_plain($options['pauseTime']) * 1000;
$view_settings['directionNav'] = check_plain($options['directionNav']);
$view_settings['directionNavHide'] = check_plain($options['directionNavHide']);
$view_settings['controlNav'] = check_plain($options['controlNav']);
$view_settings['pauseOnHover'] = check_plain($options['pauseOnHover']);
drupal_add_js(array(
'nivo_slider' => array(
$vars['nivo_slider_id'] => $view_settings,
),
), 'setting');
drupal_add_js(drupal_get_path('module', 'nivo_slider') . '/nivo_slider.js');
}