You are here

function blazy_requirements in Blazy 8

Same name and namespace in other branches
  1. 8.2 blazy.install \blazy_requirements()
  2. 7 blazy.install \blazy_requirements()

Implements hook_requirements().

File

./blazy.install, line 11
Installation actions for Blazy.

Code

function blazy_requirements($phase) {
  if ($phase != 'runtime') {
    return [];
  }
  $path = blazy_libraries_get_path('blazy') ?: \Drupal::root() . '/libraries/blazy';
  $exists = is_file($path . '/blazy.js');
  return [
    'blazy_library' => [
      'title' => t('Blazy library'),
      'description' => $exists ? '' : t('The <a href=":url">Blazy library</a> should be installed at <strong>/libraries/blazy/blazy.js</strong>, or any path supported by libraries.module if installed. Check out file or folder permissions if troubled.', [
        ':url' => 'https://github.com/dinbror/blazy',
      ]),
      'severity' => $exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
      'value' => $exists ? t('Installed') : t('Not installed'),
    ],
  ];
}