You are here

imagefield_zoom.install in Image Field Zoom 8

Contains library file requirement check and update hooks.

File

imagefield_zoom.install
View source
<?php

/**
 * @file
 * Contains library file requirement check and update hooks.
 */

/**
 * Implementation of hook_requirements().
 *
 * @param array $phase
 *    Array of different phases.
 *
 * @return array
 *    Return the requirements array.
 */
function imagefield_zoom_requirements($phase) {
  $requirements = array();
  switch ($phase) {
    case 'install':
    case 'runtime':
      $file_exists = file_exists(DRUPAL_ROOT . '/libraries/jquery_zoom/jquery.zoom.min.js');
      if ($file_exists) {
        $message = t('JQuery Zoom plugin detected in %path', [
          '%path' => '/libraries/jquery_zoom.',
        ]);
      }
      else {
        $message = t('JQuery Zoom plugin was not found. Please download it here: https://github.com/jackmoore/zoom and put the jquery.zoom.min.js file in the root so that its path is: /libraries/jquery_zoom/jquery.zoom.min.js.');
      }
      $requirements['imagefield_zoom'] = [
        'title' => t('Imagefield Zoom Plugin'),
        'value' => $message,
        'severity' => $file_exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
      ];
      break;
  }
  return $requirements;
}

Functions

Namesort descending Description
imagefield_zoom_requirements Implementation of hook_requirements().