Same name and namespace in other branches
  1. 2.0.x colorbox.install \colorbox_requirements() 1 comment
  2. 7.x-2.x colorbox.install \colorbox_requirements() 1 comment
  3. 8.x-1.x colorbox.install \colorbox_requirements() 1 comment

Implements hook_requirements().

File

./colorbox.install, line 11

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;
}