You are here

function photoswipe_requirements in PhotoSwipe 7

Same name and namespace in other branches
  1. 8.2 photoswipe.install \photoswipe_requirements()
  2. 8 photoswipe.install \photoswipe_requirements()
  3. 6 photoswipe.install \photoswipe_requirements()
  4. 7.2 photoswipe.install \photoswipe_requirements()
  5. 3.x photoswipe.install \photoswipe_requirements()

Implements hook_requirements().

File

./photoswipe.install, line 33
Install, uninstall and update hooks for Photswipe module.

Code

function photoswipe_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break at install time.
  $t = get_t();
  if ($phase == 'runtime') {
    $path = libraries_get_path('photoswipe');
    $version = photoswipe_get_version($path);
    $requirements['photoswipe'] = array(
      'title' => $t('PhotoSwipe'),
      'value' => $version,
      'severity' => REQUIREMENT_OK,
    );
    if (!$path || !file_exists($path . '/code.photoswipe.jquery-' . $version . '.min.js')) {
      $requirements['photoswipe']['value'] = $t('Third party PhotoSwipe software not properly installed');
      $requirements['photoswipe']['description'] = $t('PhotoSwipe was not found in the \'libraries\' folder (e.g. sites/all/libraries).');
      $requirements['photoswipe']['severity'] = REQUIREMENT_ERROR;
    }
  }
  return $requirements;
}