You are here

function lazy_library_get_version in Lazy-load 7

Callback function to return version from provided JSON file.

1 string reference to 'lazy_library_get_version'
lazy_libraries_info in ./lazy.module
Implements hook_libraries_info().

File

./lazy.module, line 308
Module file for Lazy-load.

Code

function lazy_library_get_version($library, $options) {
  $file = DRUPAL_ROOT . '/' . $library['library path'] . '/' . $options['file'];
  if (empty($options['file']) || !file_exists($file)) {
    return 'n/a';
  }
  $file_content = file_get_contents($file);
  $json = json_decode($file_content, TRUE);
  return $json['version'];
}