You are here

function elevatezoomplus_requirements in ElevateZoom Plus 8

Same name and namespace in other branches
  1. 7 elevatezoomplus.install \elevatezoomplus_requirements()

Implements hook_requirements().

File

./elevatezoomplus.install, line 11
Installation actions for ElevateZoomPlus.

Code

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