You are here

function fontawesome_iconpicker_get_version in Font Awesome Iconpicker 8

Same name and namespace in other branches
  1. 7 fontawesome_iconpicker.module \fontawesome_iconpicker_get_version()

Reads version of installed fontawesome iconpicker library.

See also

fontawesome_iconpicker_libraries_info()

1 string reference to 'fontawesome_iconpicker_get_version'
fontawesome_iconpicker_libraries_info in ./fontawesome_iconpicker.module
Implements hook_libraries_info().

File

./fontawesome_iconpicker.module, line 91
Contains fontawesome_iconpicker.module.

Code

function fontawesome_iconpicker_get_version($library, $options) {

  // Provide defaults.
  $options += array(
    'file' => '',
  );
  $file = DRUPAL_ROOT . '/' . $library['library path'] . '/' . $options['file'];
  if (empty($options['file']) || !file_exists($file)) {
    return;
  }
  $f = file_get_contents($file);
  $data = json_decode($f);
  return isset($data->version) ? $data->version : NULL;
}