diff --git a/blazy.install b/blazy.install index 7a44668..e2a6ae9 100644 --- a/blazy.install +++ b/blazy.install @@ -9,21 +9,19 @@ * Implements hook_requirements(). */ function blazy_requirements($phase) { - if ($phase != 'runtime') { - return []; - } + $requirements = []; - $path = blazy_libraries_get_path('blazy') ?: \Drupal::root() . '/libraries/blazy'; - $exists = is_file($path . '/blazy.js'); + if ($phase === 'runtime') { + $path = blazy_libraries_get_path('blazy') ?: \Drupal::root() . '/libraries/blazy'; + $exists = is_file($path . '/blazy.js'); - $requirements = [ - 'blazy_library' => [ + $requirements['blazy_library'] = [ 'title' => t('Blazy library'), 'description' => $exists ? '' : t('The Blazy library should be installed at /libraries/blazy/blazy.js, 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'), - ], - ]; + ]; + } if ($phase === 'update') {