You are here

views_slideshow_liquid_slider.install in Views Slideshow Liquid Slider 7.2

Same filename and directory in other branches
  1. 7 views_slideshow_liquid_slider.install

views_slideshow_liquid_slider.views_slideshow.install

File

views_slideshow_liquid_slider.install
View source
<?php

/**
 * @file
 * views_slideshow_liquid_slider.views_slideshow.install
 */

/**
 * Implements hook_requirements().
 */
function views_slideshow_liquid_slider_requirements($phase) {
  $requirements = array();
  $t = get_t();
  module_load_include('module', 'libraries', 'libraries');
  module_load_include('module', 'views_slideshow_liquid_slider', 'views_slideshow_liquid_slider');
  $verModule = '2.0.12';
  if ($phase == 'runtime') {
    $library = libraries_detect('liquidslider');
    $requirements['liquidslider'] = array(
      'title' => $t('jQuery Liquid Slider'),
      'value' => $library['installed'] ? $library['version'] : t('Not installed'),
      'severity' => $library['installed'] ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    );
    if ($library['installed']) {
      if (version_compare($library['version'], $verModule, '<')) {
        $requirements['liquidslider']['severity'] = REQUIREMENT_WARNING;
        $requirements['liquidslider']['description'] = $t('ATTENTION, the installed version is older than @verModule, (It is maybe not good)', array(
          '@verModule' => $verModule,
        ));
      }
      else {
        if (version_compare($library['version'], '2.1.0', '>=')) {
          $library_url = 'https://github.com/KevinBatdorf/liquidslider/archive/2.0.12.zip';
          $library_link = l($library_url, $library_url, array(
            'attributes' => array(
              'target' => '_blank',
            ),
          ));
          $requirements['liquidslider']['severity'] = REQUIREMENT_ERROR;
          $requirements['liquidslider']['description'] = $t('ATTENTION, the installed version is 2.1.x, this do not work actually. this should be 2.0.x ( !link )', array(
            '@verModule' => $verModule,
            '!link' => $library_link,
          ));
        }
        else {
          if (version_compare($library['version'], $verModule, '>')) {
            $requirements['liquidslider']['description'] = $t('The installed version is newer than @verModule, (It should be good)', array(
              '@verModule' => $verModule,
            ));
          }
        }
      }
    }
    else {
      $requirements['liquidslider']['description'] = _views_slideshow_liquid_slider_get_install_error_message();
    }
  }
  return $requirements;
}