You are here

viewscarousel.module in Views carousel 6.2

Same filename and directory in other branches
  1. 5 viewscarousel.module
  2. 6 viewscarousel.module

Provides a Views style plugin for jQuery jcarousel.

File

viewscarousel.module
View source
<?php

/**
 * @file
 * Provides a Views style plugin for jQuery jcarousel.
 */

/**
 * Implementation of hook_views_api().
 */
function viewscarousel_views_api() {
  return array(
    'api' => 2,
  );
}

/**
 * Themes the Views Carousel View.
 */
function theme_viewscarousel_view($view, $options = array(), $rows = array()) {

  // Remove the skin and skin path from the options.
  $skin = $options['skin'];
  $path = $skin == 'custom' ? $options['skin_path'] : NULL;
  unset($options['skin'], $options['skin_path']);

  // Remove any empty options and convert any numbers to float values.
  foreach ($options as $key => $value) {
    if (is_numeric($value)) {
      $options[$key] = (double) $value;
    }
    if (empty($value)) {
      unset($options[$key]);
    }
  }

  // Use jCarousel to create the carousel.
  return theme('jcarousel', $rows, $options, $skin, $path, 'viewscarousel-' . $view->name . '-' . $view->current_display);
}

Functions

Namesort descending Description
theme_viewscarousel_view Themes the Views Carousel View.
viewscarousel_views_api Implementation of hook_views_api().