You are here

function views_nivo_slider_add_libraries in Views Nivo Slider 7.3

Add the needed libraries and css.

1 call to views_nivo_slider_add_libraries()
template_preprocess_views_nivo_slider_view in ./views_nivo_slider.module
Implementation of template preprocess for the view

File

./views_nivo_slider.module, line 229
The implementation of Views Nivo Slider module.

Code

function views_nivo_slider_add_libraries($style = 'default') {

  // Don't load javascript unless libraries module is present.
  if (module_exists('libraries')) {
    $lib_path = libraries_get_path('nivo-slider');

    // Load jQuery plugin
    if (!empty($lib_path)) {

      // Attempt to use minified version of jQuery nivo slider plugin.
      if (file_exists($lib_path . '/jquery.nivo.slider.pack.js')) {
        drupal_add_js($lib_path . '/jquery.nivo.slider.pack.js');
      }
      elseif (file_exists($lib_path . '/jquery.nivo.slider.js')) {
        drupal_add_js($lib_path . '/jquery.nivo.slider.js');
      }

      // Load css
      drupal_add_css($lib_path . '/nivo-slider.css');
      if ($style != 'none') {
        drupal_add_css($lib_path . '/themes/' . $style . '/' . $style . '.css');
      }
    }
  }

  // Load js
  $module_path = drupal_get_path('module', 'views_nivo_slider');
  drupal_add_js($module_path . '/views_nivo_slider.js');
  drupal_add_css($module_path . '/views_nivo_slider.css');
}