You are here

function jcarousel_add in jCarousel 8.4

Same name and namespace in other branches
  1. 8.5 jcarousel.module \jcarousel_add()
  2. 8.3 jcarousel.module \jcarousel_add()
  3. 5 jcarousel.module \jcarousel_add()
  4. 6.2 jcarousel.module \jcarousel_add()
  5. 6 jcarousel.module \jcarousel_add()
  6. 7.2 jcarousel.module \jcarousel_add()

Adds all the necessary CSS and JS necessary for building a carousel.

Parameters

array $options: (optional) A list of settings to be passed to jCarousel.

Return value

array An array of JS and CSS files, suitable for inclusion as an #attached array.

Deprecated

Please use render arrays with element theme 'jcarousel' instead.

See also

jcarousel_theme()

File

./jcarousel.module, line 492
Provides integration with 3rd party modules and the jCarousel library.

Code

function jcarousel_add($options = []) {

  // Add the jCarousel library and any global settings.
  $attachments['library'][] = 'jcarousel/jcarousel';
  $options += [
    'skin' => 'default',
  ];

  // Allow other modules to modify these settings.
  \Drupal::moduleHandler()
    ->alter('jcarousel_options', $options);
  $attachments['library'][] = 'jcarousel/skin.' . $options['skin'];
  return $attachments;
}