function superfish_requirements in Superfish 7
Same name and namespace in other branches
- 8 superfish.install \superfish_requirements()
- 6 superfish.install \superfish_requirements()
Implements hook_requirements().
File
- ./superfish.install, line 32 
- Install, update and uninstall functions for the Superfish module.
Code
function superfish_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    // Ensure translations do not break at install time.
    $t = get_t();
    // Ensure the Superfish library is present.
    $requirements['superfish']['title'] = $t('Superfish library');
    if (superfish_library_check()) {
      $requirements['superfish']['value'] = $t('Installed');
      $requirements['superfish']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['superfish']['value'] = $t('Not installed');
      $requirements['superfish']['severity'] = REQUIREMENT_ERROR;
      $requirements['superfish']['description'] = $t('Please download the Superfish library from !link.', array(
        '!link' => l($t('Superfish project homepage'), 'http://drupal.org/project/superfish'),
      ));
    }
    // Check the uploaded Superfish library version.
    if (superfish_library_version() != '1.2') {
      $requirements['superfish']['value'] = $t('Not supported');
      $requirements['superfish']['severity'] = REQUIREMENT_ERROR;
      $requirements['superfish']['description'] = $t('The Superfish library requires an update. You can find the update instructions on !link.', array(
        '!link' => l($t('Superfish project homepage'), 'http://drupal.org/project/superfish'),
      ));
    }
  }
  return $requirements;
}