You are here

public static function Openlayers::getLocalLibraryVersion in Openlayers 7.3

Return the version of the Openlayers library in use.

Return value

string Return the version of the Openlayers library in the filesystem.

2 calls to Openlayers::getLocalLibraryVersion()
Openlayers::getLibraryVersion in src/Openlayers.php
Return the version of the Openlayers library in use.
openlayers_libraries_info in ./openlayers.module
Implements hook_libraries_info().

File

src/Openlayers.php, line 268
Contains Openlayers.

Class

Openlayers
Class Openlayers.

Namespace

Drupal\openlayers

Code

public static function getLocalLibraryVersion() {
  $version = FALSE;
  if ($path = libraries_get_path('openlayers3')) {
    $library = libraries_detect('openlayers3');
    $options = array(
      'file' => 'build/ol.js',
      'pattern' => '@Version: (.*)@',
      'lines' => 3,
    );
    $library['library path'] = $path;
    if ($version = libraries_get_version($library, $options)) {
      $version = substr($version, 1);
    }
  }
  return $version;
}