You are here

function slick_requirements in Slick Carousel 8.2

Same name and namespace in other branches
  1. 8 slick.install \slick_requirements()
  2. 7.3 slick.install \slick_requirements()
  3. 7.2 slick.install \slick_requirements()

Implements hook_requirements().

File

./slick.install, line 11
Installation actions for Slick.

Code

function slick_requirements($phase) {
  if ($phase != 'runtime') {
    return [];
  }
  $path = slick('skin')
    ->getSlickPath();
  $exists = $path ? is_file($path . '/slick/slick.min.js') : FALSE;
  if (slick('skin')
    ->config('library') == 'accessible-slick') {
    $name = 'Accessible Slick';
    $url = 'https://github.com/Accessible360/accessible-slick';
    $libpath = '<strong>/libraries/accessible-slick/slick/slick.min.js</strong>';
  }
  else {
    $name = 'Slick';
    $url = 'https://github.com/kenwheeler/slick/';
    $libpath = '<strong>/libraries/slick-carousel/slick/slick.min.js</strong>, or <strong>/libraries/slick/slick/slick.min.js</strong>';
  }
  return [
    'slick_library' => [
      'title' => t('Slick library'),
      'description' => $exists ? '' : t('The <a href=":url">@name library</a> should be installed at @libpath, or any path supported by libraries.module if installed. Check out file or folder permissions if troubled.', [
        ':url' => $url,
        '@name' => $name,
        '@libpath' => $libpath,
      ]),
      'severity' => $exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
      'value' => $exists ? t('@name library installed at @path', [
        '@name' => $name,
        '@path' => $path,
      ]) : t('@name library not installed', [
        '@name' => $name,
      ]),
    ],
  ];
}