You are here

function jqmulti_get_version in jQuery Multi 7

Same name in this branch
  1. 7 jqmulti.module \jqmulti_get_version()
  2. 7 jqmulti.api.php \jqmulti_get_version()
Same name and namespace in other branches
  1. 6 jqmulti.module \jqmulti_get_version()

Gets the version of jQuery to load.

Modules that rely on jQuery Multi can use this method in their installation procedures to make sure that a satisfactory version of jQuery is present.

Parameters

$reset: whether to reset the cached version number. When using this to check for a required jQuery version, it's a good idea to set this to TRUE

3 calls to jqmulti_get_version()
jqmulti_admin_form in ./jqmulti.admin.inc
Admin form for jQuery Multi module.
jqmulti_jquery_path in ./jqmulti.module
Returns the path to the currently selected version of jQuery.
jqmulti_requirements in ./jqmulti.install
Implements hook_requirements().

File

./jqmulti.api.php, line 55
API documentation for the jQuery Multi module

Code

function jqmulti_get_version($reset = FALSE) {
  $libraries = libraries_get_libraries();
  if (isset($libraries['jquery'])) {
    $files = jqmulti_get_library_files('jquery', $reset);
    if ($files) {
      foreach ($files as $file) {

        // Get the file name.
        $version = jqmulti_jquery_version_from_path($file);
        if ($version) {
          cache_set('jqmulti_version', $version);
          return $version;
        }
      }
    }
  }
  return FALSE;
}