You are here

views_slideshow_cycle.module in Views Slideshow 6.3

Same filename and directory in other branches
  1. 7.3 contrib/views_slideshow_cycle/views_slideshow_cycle.module

Views Slideshow: cycle is typically used for field views.

File

contrib/views_slideshow_cycle/views_slideshow_cycle.module
View source
<?php

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

/**
 * Gets the path to the jQuery cycle library.
 *
 * @return
 *   The path to the cycle library js file, or FALSE if not found.
 */
function _views_slideshow_cycle_library_path() {
  $cycle_path = libraries_get_path('jquery.cycle');
  if (!empty($cycle_path)) {

    // Attempt to use minified version of jQuery cycle plugin.
    if (file_exists($cycle_path . '/jquery.cycle.all.min.js')) {
      $cycle_path .= '/jquery.cycle.all.min.js';
    }
    elseif (file_exists($cycle_path . '/jquery.cycle.all.js')) {
      $cycle_path .= '/jquery.cycle.all.js';
    }
    else {
      $cycle_path = FALSE;
    }
  }
  else {
    $cycle_path = FALSE;
  }
  return $cycle_path;
}

/**
 * Gets the path to the jQuery pause library.
 *
 * @return
 *   The path to the pause library js file, or FALSE if not found.
 */
function _views_slideshow_cycle_pause_library_path() {
  $pause_path = libraries_get_path('jquery.pause');
  if (!empty($pause_path)) {

    // Attempt to use minified version of jQuery pause plugin.
    if (file_exists($pause_path . '/jquery.pause.min.js')) {
      $pause_path .= '/jquery.pause.min.js';
    }
    elseif (file_exists($pause_path . '/jquery.pause.js')) {
      $pause_path .= '/jquery.pause.js';
    }
    else {
      $pause_path = FALSE;
    }
  }
  else {
    $pause_path = FALSE;
  }
  return $pause_path;
}

/**
 * Implements hook_theme().
 */
function views_slideshow_cycle_theme($existing, $type, $theme, $path) {
  return array(
    'views_slideshow_cycle' => array(
      'arguments' => array(
        'view' => NULL,
        'settings' => array(),
        'rows' => array(),
        'title' => '',
      ),
      'template' => 'theme/views-slideshow-cycle',
      'file' => 'theme/views_slideshow_cycle.theme.inc',
      'pattern' => 'views_slideshow_cycle__',
    ),
    'views_slideshow_cycle_main_frame' => array(
      'arguments' => array(
        'vss_id' => NULL,
        'view' => NULL,
        'settings' => NULL,
        'rows' => NULL,
      ),
      'template' => 'theme/views-slideshow-cycle-main-frame',
      'file' => 'theme/views_slideshow_cycle.theme.inc',
      'pattern' => 'views_slideshow_cycle_main_frame__',
    ),
    'views_slideshow_cycle_main_frame_row' => array(
      'arguments' => array(
        'vss_id' => NULL,
        'items' => NULL,
        'count' => NULL,
        'view' => NULL,
      ),
      'template' => 'theme/views-slideshow-cycle-main-frame-row',
      'pattern' => 'views_slideshow_cycle_main_frame_row__',
    ),
    'views_slideshow_cycle_main_frame_row_item' => array(
      'arguments' => array(
        'item' => NULL,
        'item_count' => NULL,
        'count' => NULL,
        'view' => NULL,
        'length' => NULL,
      ),
      'template' => 'theme/views-slideshow-cycle-main-frame-row-item',
      'pattern' => 'views_slideshow_cycle_main_frame_row_item__',
    ),
  );
}

/**
 * Implements hook_help().
 */
function views_slideshow_cycle_help($path, $arg) {
  switch ($path) {
    case 'admin/help#views_slideshow_cycle':
      if (module_exists('advanced_help')) {
        $output = '<p>' . l(t('Click here to view the documentation for Views Slideshow Cycle.'), 'admin/advanced_help/views_slideshow_cycle') . '</p>';
      }
      else {
        $output = '<p>' . t('Views Slideshow Cycle help can be found by installing and enabling the !advanced_help', array(
          '!advanced_help' => l('Advanced Help module', 'http://drupal.org/project/advanced_help'),
        )) . '</p>';
      }
      return $output;
  }
}

/**
 * Need to have preprocess functions here because drupal doesn't cache them
 * correctly in the theme.inc file.
 *
 * If you would like to override the preprocess functions make sure to look at
 * the associated function in theme.inc.
 */

// Trying to make sure the theme.inc get's loaded.
include_once 'theme/views_slideshow_cycle.theme.inc';
function template_preprocess_views_slideshow_cycle_main_frame(&$vars) {
  _views_slideshow_cycle_preprocess_views_slideshow_cycle_main_frame($vars);
}
function template_preprocess_views_slideshow_cycle_main_frame_row(&$vars) {
  _views_slideshow_cycle_preprocess_views_slideshow_cycle_main_frame_row($vars);
}
function template_preprocess_views_slideshow_cycle_main_frame_row_item(&$vars) {
  _views_slideshow_cycle_preprocess_views_slideshow_cycle_main_frame_row_item($vars);
}