You are here

function lightgallery_requirements in Lightgallery 7

Same name and namespace in other branches
  1. 8 lightgallery.install \lightgallery_requirements()

Implements hook_requirements().

File

./lightgallery.install, line 11
Installation file for Lightgallery module.

Code

function lightgallery_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'runtime') {
    $requirements['lightgallery']['title'] = 'Lightgallery';
    $requirements['lightgallery']['value'] = $t('Installed');
    if (module_exists('libraries') && file_exists(libraries_get_path('lightgallery') . '/dist/js/lightgallery.min.js')) {
      $requirements['lightgallery']['severity'] = REQUIREMENT_OK;
    }
    else {

      // Required lightgallery library wasn't found; abort installation.
      $requirements['lightgallery']['value'] = $t('Not found');

      // Provide a download link to the lightgallery jQuery plugin.
      $requirements['lightgallery']['description'] = $t('The <a href="!lightgallery">Lightgallery</a> jQuery plugin is missing. See !readme for instructions on how to download and extract it.', array(
        '!lightgallery' => 'http://sachinchoolur.github.io/lightGallery/',
        '!readme' => l($t('README.txt'), drupal_get_path('module', 'lightgallery') . "/README.txt"),
      ));
      $requirements['lightgallery']['severity'] = REQUIREMENT_ERROR;
    }
  }
  return $requirements;
}