You are here

views_slideshow_jcarousel.module in Views Slideshow JCarousel 8

Views Slideshow: JCarousel is typically used for field views.

File

views_slideshow_jcarousel.module
View source
<?php

/**
 * @file
 * Views Slideshow: JCarousel is typically used for field views.
 */

/**
 * Implements hook_theme().
 */
function views_slideshow_jcarousel_theme($existing, $type, $theme, $path) {
  return [
    'views_slideshow_jcarousel_pager' => [
      'variables' => [
        'vss_id' => NULL,
        'view' => NULL,
        'settings' => [],
        'location' => NULL,
        'attributes' => [],
      ],
      'template' => 'views-slideshow-jcarousel-pager',
    ],
    'views_slideshow_jcarousel_pager_field' => [
      'variables' => [
        'view' => NULL,
        'label' => NULL,
        'output' => NULL,
        'css_identifier' => NULL,
      ],
      'template' => 'views-slideshow-jcarousel-pager-field',
      'file' => 'views_slideshow_jcarousel.theme.inc',
    ],
    'views_slideshow_jcarousel_pager_item' => [
      'variables' => [
        'vss_id' => NULL,
        'item' => NULL,
        'count' => NULL,
        'location' => NULL,
      ],
      'template' => 'views-slideshow-jcarousel-pager-item',
    ],
  ];
}

/**
 * Implements hook_preprocess_views_slideshow_jcarousel_pager().
 *
 * As it is a preprocess function, store it with other functions in theme.inc.
 */
function views_slideshow_preprocess_views_slideshow_jcarousel_pager(&$vars) {
  \Drupal::moduleHandler()
    ->loadInclude('views_slideshow_jcarousel', 'inc', 'views_slideshow_jcarousel.theme');
  _views_slideshow_jcarousel_preprocess_pager($vars);
}

/**
 * Implements hook_preprocess_views_slideshow_jcarousel_pager_item().
 *
 * As it is a preprocess function, store it with other functions in theme.inc.
 */
function views_slideshow_preprocess_views_slideshow_jcarousel_pager_item(&$vars) {
  \Drupal::moduleHandler()
    ->loadInclude('views_slideshow_jcarousel', 'inc', 'views_slideshow_jcarousel.theme');
  _views_slideshow_jcarousel_preprocess_pager_item($vars);
}

/**
 * Implements hook_library_info_build().
 */
function views_slideshow_jcarousel_library_info_build() {
  $libraries = [];
  $library_path = DRUPAL_ROOT . '/libraries/jcarousel/skins';
  foreach (scandir($library_path) as $dir) {
    if ($dir !== '.' && $dir !== '..' && is_dir($library_path . '/' . $dir)) {
      $libraries['jcarousel.skins.' . $dir] = [
        'remote' => 'https://github.com/jsor/jcarousel',
        'version' => '0.3.9',
        'license' => [
          'name' => 'MIT',
          'url' => 'https://github.com/jsor/jcarousel/blob/master/LICENSE',
          'gpl-compatible' => 'true',
        ],
        'css' => [
          'component' => [
            '/libraries/jcarousel/skins/' . $dir . '/skin.css' => [],
          ],
        ],
      ];
    }
  }
  return $libraries;
}

Functions

Namesort descending Description
views_slideshow_jcarousel_library_info_build Implements hook_library_info_build().
views_slideshow_jcarousel_theme Implements hook_theme().
views_slideshow_preprocess_views_slideshow_jcarousel_pager Implements hook_preprocess_views_slideshow_jcarousel_pager().
views_slideshow_preprocess_views_slideshow_jcarousel_pager_item Implements hook_preprocess_views_slideshow_jcarousel_pager_item().