You are here

function colorbox_requirements in Colorbox 7

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

Implements 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();
    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 and extract the entire contents of the archive into the %path folder of your server.', array(
          '!colorbox' => l(t('Colorbox plugin'), 'https://github.com/jackmoore/colorbox/archive/1.x.zip'),
          '%path' => $library_path,
        )),
      );
    }
  }
  return $requirements;
}