You are here

function imagefield_zoom_requirements in Image Field Zoom 8

Implementation of hook_requirements().

Parameters

array $phase: Array of different phases.

Return value

array Return the requirements array.

File

./imagefield_zoom.install, line 16
Contains library file requirement check and update hooks.

Code

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;
}