You are here

elevatezoomplus.install in ElevateZoom Plus 8

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

Installation actions for ElevateZoomPlus.

File

elevatezoomplus.install
View source
<?php

/**
 * @file
 * Installation actions for ElevateZoomPlus.
 */

/**
 * Implements hook_requirements().
 */
function elevatezoomplus_requirements($phase) {
  if ($phase != 'runtime') {
    return [];
  }
  $requirements = [];

  // ElevateZoomPlus library.
  if (elevatezoomplus_libraries_get_path('elevatezoom-plus') || elevatezoomplus_libraries_get_path('ez-plus')) {
    $path = elevatezoomplus_libraries_get_path('elevatezoom-plus') ?: elevatezoomplus_libraries_get_path('ez-plus');
  }
  else {
    $path = DRUPAL_ROOT . '/libraries/elevatezoom-plus';
    if (!is_file($path . '/src/jquery.ez-plus.js')) {
      $path = DRUPAL_ROOT . '/libraries/ez-plus';
    }
  }
  $exists = is_file($path . '/src/jquery.ez-plus.js');
  $requirements['elevatezoomplus_library'] = [
    'title' => t('ElevateZoom Plus library'),
    'description' => $exists ? '' : t('The <a href=":url">ElevateZoom Plus library</a> should be installed at <strong>/libraries/elevatezoom-plus/src/jquery.ez-plus.js</strong>, or any path supported by libraries.module if installed. Check out file or folder permissions if troubled.', [
      ':url' => 'https://github.com/igorlino/elevatezoom-plus',
    ]),
    'severity' => $exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    'value' => $exists ? t('Installed') : t('Not installed'),
  ];
  return $requirements;
}

Functions