You are here

views_slideshow_slider.module in Views Slideshow Slider 6.2

Same filename and directory in other branches
  1. 6.3 views_slideshow_slider.module
  2. 7.3 views_slideshow_slider.module

Views Slideshow: slider has options for working with node views.

The slider mode adds two parts to the view: the first part is a series of items displayed as a list, the second part is either a full node or a node teaser. The slideshow will synchronize the two, so that the 'active' item will correspond to the single full/teaser item. The slide show can be set to advance automatically or on mouse hover/click.

File

views_slideshow_slider.module
View source
<?php

/**
 * @file
 * Views Slideshow: slider has options for working with node views.
 *
 * The slider mode adds two parts to the view: the first part is a
 * series of items displayed as a list, the second part is either a full node
 * or a node teaser. The slideshow will synchronize the two, so that the
 * 'active' item will correspond to the single full/teaser item. The slide show
 * can be set to advance automatically or on mouse hover/click.
 */

/**
 * Minimal jQuery UI version the slider is compatible with.
 **/
define('VS_SLIDER_JQUERY_UI_VERSION', 1.7);

/**
 * Implements hook_init().
 */
function views_slideshow_slider_init() {

  // If the jQ module is installed, use that to add the jQuery Cycle plugin.
  // This allows different versions of the plugin to be used.
  $js = FALSE;
  if (module_exists('jq')) {
    $loaded_plugins = jq_plugins();
    if (!empty($loaded_plugins['cycle'])) {
      $js = jq_add('cycle');
    }
  }

  // Otherwise, we'll add the version included with this module.
  if (!$js) {
    drupal_add_js(drupal_get_path('module', 'views_slideshow') . '/js/jquery.cycle.all.min.js');
  }
  $module_path = drupal_get_path('module', 'views_slideshow_slider');
  drupal_add_js($module_path . '/views_slideshow.js', 'module');
  drupal_add_css($module_path . '/views_slideshow.css', 'module');
}

/**
 * Implementation of hook_requirements().
 */
function views_slideshow_slider_requirements($phase) {
  $requirements = array();
  $t = get_t();
  $version = jquery_ui_get_version();
  $requirements['slider_jquery_ui'] = array(
    'title' => $t('Slider jQuery UI compatibility'),
    'value' => $version,
  );
  if (version_compare($version, VS_SLIDER_JQUERY_UI_VERSION) < 0) {
    $requirements['slider_jquery_ui']['descripion'] = $t('Views Slideshow Slider needs at least 1.7 version of the jQuery UI.');
    $requirements['slider_jquery_ui']['severity'] = REQUIREMENT_ERROR;
  }
  return $requirements;
}

/**
 * Implements hook_theme().
 */
function views_slideshow_slider_theme($existing, $type, $theme, $path) {
  return array(
    'views_slideshow_slider' => array(
      'arguments' => array(
        'view' => NULL,
        'options' => array(),
        'rows' => array(),
        'title' => '',
      ),
      'template' => 'views-slideshow-slider',
      'file' => 'views_slideshow_slider.theme.inc',
    ),
    'views_slideshow_slider_controls' => array(
      'arguments' => array(
        'id' => '',
        'view' => NULL,
        'options' => array(),
      ),
      'file' => 'views_slideshow_slider.theme.inc',
    ),
    'views_slideshow_slider_control_previous' => array(
      'arguments' => array(
        'id' => '',
        'view' => NULL,
        'options' => array(),
      ),
      'file' => 'views_slideshow_slider.theme.inc',
    ),
    'views_slideshow_slider_control_pause' => array(
      'arguments' => array(
        'id' => '',
        'view' => NULL,
        'options' => array(),
      ),
      'file' => 'views_slideshow_slider.theme.inc',
    ),
    'views_slideshow_slider_control_next' => array(
      'arguments' => array(
        'id' => '',
        'view' => NULL,
        'options' => array(),
      ),
      'file' => 'views_slideshow_slider.theme.inc',
    ),
    'views_slideshow_slider_pager' => array(
      'arguments' => array(
        'id' => '',
        'view' => NULL,
        'options' => array(),
      ),
      'file' => 'views_slideshow_slider.theme.inc',
    ),
    'views_slideshow_slider_image_count' => array(
      'arguments' => array(
        'id' => '',
        'view' => NULL,
        'options' => array(),
      ),
      'file' => 'views_slideshow_slider.theme.inc',
    ),
    'views_slideshow_slider_no_display_section' => array(
      'arguments' => array(
        'view' => NULL,
        'rows' => NULL,
        'id' => NULL,
        'mode' => NULL,
        'teaser' => TRUE,
      ),
      'file' => 'views_slideshow_slider.theme.inc',
    ),
    'views_slideshow_slider_no_display_teaser' => array(
      'arguments' => array(
        'item' => NULL,
        'id' => NULL,
        'count' => NULL,
      ),
      'file' => 'views_slideshow_slider.theme.inc',
    ),
    'views_slideshow_slider_slider' => array(
      'arguments' => array(
        'id' => NULL,
      ),
      'file' => 'views_slideshow_slider.theme.inc',
    ),
  );
}

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

Functions

Constants

Namesort descending Description
VS_SLIDER_JQUERY_UI_VERSION Minimal jQuery UI version the slider is compatible with.