You are here

function slider_pro_requirements in Slider Pro 7

Same name and namespace in other branches
  1. 8 slider_pro.install \slider_pro_requirements()

Implements hook_requirements().

File

./slider_pro.install, line 11
Installation file for Silder Pro module.

Code

function slider_pro_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'runtime') {
    $requirements['slider_pro']['title'] = 'Slider Pro';
    $requirements['slider_pro']['value'] = $t('Installed');
    if (module_exists('libraries') && file_exists(libraries_get_path('slider-pro') . '/dist/js/jquery.sliderPro.min.js')) {
      $requirements['slider_pro']['severity'] = REQUIREMENT_OK;
    }
    else {

      // Required slider pro library wasn't found; abort installation.
      $requirements['slider_pro']['value'] = $t('Not found');

      // Provide a download link to the Slider Pro jQuery plugin.
      $requirements['slider_pro']['description'] = $t('The <a href="!sliderpro">Slider Pro</a> jQuery plugin is missing. See !readme for instructions on how to download and extract it.', array(
        '!sliderpro' => 'http://bqworks.com/slider-pro/',
        '!readme' => l($t('README.txt'), drupal_get_path('module', 'slider_pro') . "/README.txt"),
      ));
      $requirements['slider_pro']['severity'] = REQUIREMENT_ERROR;
    }
  }
  return $requirements;
}