You are here

function blazy_test_library_info_alter in Blazy 8

Same name and namespace in other branches
  1. 8.2 tests/modules/blazy_test/blazy_test.module \blazy_test_library_info_alter()

Implements hook_library_info_alter().

File

tests/modules/blazy_test/blazy_test.module, line 82
Testing various Blazy hooks, etc.

Code

function blazy_test_library_info_alter(array &$libraries, $extension) {
  if ($extension !== 'blazy') {
    return;
  }
  $path = \Drupal::root() . '/libraries/blazy/blazy.min.js';
  if (!is_file($path)) {
    $libraries['blazy']['js'] = [
      'https://cdn.jsdelivr.net/blazy/latest/blazy.min.js' => [
        'type' => 'external',
        'weight' => -4,
      ],
    ];
    unset($libraries['blazy']['js']['/libraries/blazy/blazy.min.js']);
  }
}