You are here

views_quicksand.install in Views Quicksand 7

File

views_quicksand.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the views_quicksand module.
 */
require_once 'views_quicksand.module';

/**
 * Implements hook_requirements().
 */
function views_quicksand_requirements($phase) {
  $requirements = array();
  $t = get_t();
  $library_path = views_quicksand_get_path();

  // make sure that libraries is enabled
  if (!module_exists('libraries')) {
    module_enable(array(
      'libraries',
    ));
  }
  $libraries = libraries_get_libraries();
  if ($phase == 'runtime') {
    if (isset($libraries['jquery.quicksand'])) {
      $requirements['jquery.quicksand'] = array(
        'title' => $t('Quicksand plugin'),
        'value' => $t('Installed'),
        'severity' => REQUIREMENT_OK,
      );
    }
    else {
      $requirements['jquery.quicksand'] = array(
        'title' => $t('Quicksand plugin'),
        'value' => $t('Not Installed'),
        'severity' => REQUIREMENT_ERROR,
        'description' => $t('You need to download the !quicksand and extract the entire contents of the archive into the %path folder of your server.', array(
          '!quicksand' => l(t('Quicksand plugin'), 'http://razorjack.net/quicksand/'),
          '%path' => $library_path,
        )),
      );
    }
  }
  return $requirements;
}

/**
 * Implements hook_enable().
 */
function views_quicksand_enable() {
  $library_path = views_quicksand_get_path();
  $libraries = libraries_get_libraries();
  if (!isset($libraries['jquery.quicksand'])) {
    drupal_set_message(t('You need to download the !quicksand and extract the entire contents of the archive into the %path folder of your server.', array(
      '!quicksand' => l(t('Quicksand plugin'), 'http://razorjack.net/quicksand/'),
      '%path' => $library_path,
    )), 'error');
  }
}

Functions