You are here

function colorbox_requirements in Colorbox 6

Same name and namespace in other branches
  1. 8 colorbox.install \colorbox_requirements()
  2. 7.2 colorbox.install \colorbox_requirements()
  3. 7 colorbox.install \colorbox_requirements()

Implementation of hook_requirements().

File

./colorbox.install, line 11
Install, update and uninstall functions for the colorbox module.

Code

function colorbox_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $t = get_t();
    $library_path = colorbox_get_path();
    $colorbox_version = colorbox_get_version();
    $jquery_version = FALSE;
    if (function_exists('jquery_update_get_version')) {
      if (version_compare(jquery_update_get_version(), COLORBOX_MIN_JQUERY_VERSION, '>=')) {
        $jquery_version = TRUE;
      }
    }
    if (!$jquery_version) {
      $requirements['colorbox_jquery_version'] = array(
        'title' => $t('Colorbox required jQuery version'),
        'value' => $t('Between @a and @b', array(
          '@a' => COLORBOX_MIN_JQUERY_VERSION,
          '@b' => COLORBOX_MAX_JQUERY_VERSION,
        )),
        'severity' => REQUIREMENT_ERROR,
        'description' => $t('You need to download and install a 6.x-2.0 version of the !jquery_update module.', array(
          '!jquery_update' => l(t('jQuery Update'), 'http://drupal.org/project/jquery_update'),
        )),
      );
    }
    if (version_compare($colorbox_version, COLORBOX_MIN_PLUGIN_VERSION, '=')) {
      $requirements['colorbox_plugin'] = array(
        'title' => $t('Colorbox plugin'),
        'severity' => REQUIREMENT_OK,
        'value' => $colorbox_version,
      );
    }
    else {
      $requirements['colorbox_plugin'] = array(
        'title' => $t('Colorbox plugin'),
        'value' => $t('At least @a', array(
          '@a' => COLORBOX_MIN_PLUGIN_VERSION,
        )),
        'severity' => REQUIREMENT_ERROR,
        'description' => $t('You need to download the !colorbox, extract the archive and place the colorbox directory in the %path directory on your server.', array(
          '!colorbox' => l($t('Colorbox plugin v1.3.18'), 'http://www.jacklmoore.com/colorbox/colorbox-1.3.18.zip'),
          '%path' => $library_path,
        )),
      );
    }
  }
  return $requirements;
}