You are here

function itoggle_requirements in iToggle 7

Implements hook_requirements(). This was borrowed from the Colorbox module

@link http://drupal.org/project/colorbox

File

./itoggle.install, line 13
iToggle installation hooks.

Code

function itoggle_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $t = get_t();
    $library_path = itoggle_get_path();
    $itoggle_version = itoggle_get_version();
    if (version_compare($itoggle_version, ITOGGLE_MIN_PLUGIN_VERSION, '>=')) {
      $requirements['itoggle_plugin'] = array(
        'title' => $t('iToggle plugin'),
        'severity' => REQUIREMENT_OK,
        'value' => $itoggle_version,
      );
    }
    else {
      $requirements['itoggle_plugin'] = array(
        'title' => $t('iToggle plugin'),
        'value' => $t('At least @a', array(
          '@a' => ITOGGLE_MIN_PLUGIN_VERSION,
        )),
        'severity' => REQUIREMENT_ERROR,
        'description' => $t('You need to download the !itoggle and extract the entire contents of the archive into the %path folder of your server.', array(
          '!itoggle' => l(t('iToggle plugin'), 'http://colorpowered.com/itoggle/'),
          '%path' => $library_path,
        )),
      );
    }
  }
  return $requirements;
}