You are here

function elevatezoomplus_requirements in ElevateZoom Plus 7

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

Implements hook_requirements().

File

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

Code

function elevatezoomplus_requirements($phase) {
  if ($phase != 'runtime') {
    return [];
  }
  $requirements = [];

  // Ensure translations do not break at install time.
  $t = get_t();

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