You are here

function _jquery_carousel_include_css_js in jQuery carousel 7

Same name and namespace in other branches
  1. 8 jquery_carousel.module \_jquery_carousel_include_css_js()

Helper function to inject required Css & Js.

2 calls to _jquery_carousel_include_css_js()
theme_jquery_carousel_field_formatter in ./jquery_carousel.module
Theme callback for jQeury carousel field formatter.
_jquery_carousel_preprocess_jquery_carousel in views/theme/jquery_carousel.theme.inc
Preprocessor for jquery carousel view style plugin.

File

./jquery_carousel.module, line 373
Provide jquery carousel style plugin for views.

Code

function _jquery_carousel_include_css_js($settings) {
  $themes = jquery_carousel_themes();
  drupal_add_library('system', 'ui.widget');
  if (isset($settings['theme']) && $settings['theme']) {
    drupal_add_css(drupal_get_path('module', $themes[$settings['theme']]['module']) . '/' . $themes[$settings['theme']]['file']);
  }
  drupal_add_css(libraries_get_path('jquery-ui-carousel') . '/dist/css/jquery.rs.carousel.css');
  drupal_add_js(libraries_get_path('jquery-ui-carousel') . '/dist/js/jquery.rs.carousel.js');
  drupal_add_js(libraries_get_path('jquery-ui-carousel') . '/dist/js/jquery.rs.carousel-autoscroll.js');
  drupal_add_js(libraries_get_path('jquery-ui-carousel') . '/dist/js/jquery.rs.carousel-continuous.js');
  drupal_add_js(libraries_get_path('jquery-ui-carousel') . '/dist/js/jquery.rs.carousel-touch.js');
  drupal_add_js(drupal_get_path('module', 'jquery_carousel') . '/js/jquery_carousel.init.js');
  if (isset($settings['touch']) && $settings['touch']) {
    drupal_add_js(libraries_get_path('jquery-ui-carousel') . '/vendor/jquery.event.drag.js');
  }
  _jquery_carousel_settings_format($settings);
  drupal_add_js(array(
    'jquery_carousel' => array(
      $settings['selector'] => $settings,
    ),
  ), 'setting');
}