You are here

views_quicksand.module in Views Quicksand 7

jQuery Plugin that provides a nice animation for filtering or reordering lists of content.

File

views_quicksand.module
View source
<?php

/**
 * @file
 * jQuery Plugin that provides a nice animation for filtering or reordering
 * lists of content.
 */

/**
 * The default path to the jQuery Quicksand Plugin directory.
 */
define('VIEWS_QUICKSAND_PATH', 'sites/all/libraries/jquery.quicksand');

/**
 * Implements hook_help().
 */
function views_quicksand_help($path, $arg) {
  switch ($path) {
    case 'admin/help#views_quicksand':
      $output = '<p>' . t('The Views Quicksand module is a Views style plugin that ' . 'displays the results in a JQuery Quicksand style.') . '</p>';
      return $output;
  }
}

/**
 * Template function for views_quicksand style plugin.
 *
 * @param array $vars
 *  Array of template variables.
 *
 * The JS file is loaded within render() in views_quicksand_style_plugin.inc .
 */
function template_preprocess_views_view_quicksand(&$vars) {

  // inherit the normal unformatted classes.
  template_preprocess_views_view_unformatted($vars);
  $vars['view_quicksand_id'] = 'views-quicksand-' . $vars['view']->name . '-' . $vars['view']->current_display . '-header';
}

/**
 * Implements hook_views_api().
 */
function views_quicksand_views_api() {
  return array(
    'api' => 2,
  );
}

/**
 * Return the path to the jQuery Quicksand plugin.
 */
function views_quicksand_get_path() {
  static $library_path = NULL;

  // Try to locate the library path in any possible setup.
  if ($library_path == NULL) {

    // First check the default location.
    $path = variable_get('views_quicksand_path', VIEWS_QUICKSAND_PATH);
    if (file_exists($path . '/jquery.quicksand.js')) {
      $library_path = $path;
    }
    else {
      if ($path = libraries_get_path('jquery.quicksand')) {
        $library_path = $path;
        variable_set('views_quicksand_path', $library_path);
      }
      else {
        $library_path = VIEWS_QUICKSAND_PATH;
      }
    }
  }
  return $library_path;
}

Functions

Namesort descending Description
template_preprocess_views_view_quicksand Template function for views_quicksand style plugin.
views_quicksand_get_path Return the path to the jQuery Quicksand plugin.
views_quicksand_help Implements hook_help().
views_quicksand_views_api Implements hook_views_api().

Constants

Namesort descending Description
VIEWS_QUICKSAND_PATH The default path to the jQuery Quicksand Plugin directory.