You are here

function libraries_get_path in Libraries API 8.3

Same name and namespace in other branches
  1. 6 libraries.module \libraries_get_path()
  2. 7.3 libraries.module \libraries_get_path()
  3. 7 libraries.module \libraries_get_path()
  4. 7.2 libraries.module \libraries_get_path()

Gets the path of a library.

Parameters

$name: The machine name of a library to return the path for.

$base_path: Whether to prefix the resulting path with base_path().

Return value

The path to the specified library or FALSE if the library wasn't found.

Deprecated

Will be removed before a stable Drupal 8 release. Please use the new library load and managment concepts described at: https://www.drupal.org/node/2170763

Related topics

2 calls to libraries_get_path()
LibrariesUnitTest::testLibrariesGetPath in src/Tests/LibrariesUnitTest.php
Tests libraries_get_path().
libraries_detect in ./libraries.module
Tries to detect a library and its installed version.

File

./libraries.module, line 72
External library handling for Drupal modules.

Code

function libraries_get_path($name, $base_path = FALSE) {
  $libraries =& drupal_static(__FUNCTION__);
  if (!isset($libraries)) {
    $libraries = libraries_get_libraries();
  }
  $path = $base_path ? base_path() : '';
  if (!isset($libraries[$name])) {
    return FALSE;
  }
  else {
    $path .= $libraries[$name];
  }
  return $path;
}