You are here

function _jquery_carousel_include_css_js in jQuery carousel 8

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

Helper function to inject required Css & Js.

2 calls to _jquery_carousel_include_css_js()
template_preprocess_jquery_carousel_field_formatter in ./jquery_carousel.module
Theme callback for jQuery carousel field formatter.
template_preprocess_views_view_jquery_carousel in ./jquery_carousel.module
Prepares variables for views jquery_carousel templates.

File

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

Code

function _jquery_carousel_include_css_js(&$vars, $settings) {
  $themes = jquery_carousel_themes();
  $vars['#attached']['library'][] = 'system/ui.widget';
  if (isset($settings['theme']) && $settings['theme']) {
    $vars['#attached']['library'][] = $themes[$settings['theme']]['library'];
  }
  $vars['#attached']['library'][] = 'jquery_carousel/jquery_ui_carousel';
  $vars['#attached']['library'][] = 'jquery_carousel/drupal.jquery_carousel';
  if (isset($settings['touch']) && $settings['touch']) {
    $vars['#attached']['library'][] = 'jquery_carousel/jquery_ui_carousel_touch';
  }
  $vars['#attached']['drupalSettings']['jquery_carousel'] = [
    $settings['selector'] => $settings,
  ];
}