You are here

lightgallery.install in Lightgallery 7

Same filename and directory in other branches
  1. 8 lightgallery.install

Installation file for Lightgallery module.

File

lightgallery.install
View source
<?php

/**
 * @file
 * Installation file for Lightgallery module.
 */

/**
 * Implements hook_requirements().
 */
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;
}

Functions