function libraries_get_path in Libraries API 6
Same name and namespace in other branches
- 8.3 libraries.module \libraries_get_path()
- 7.3 libraries.module \libraries_get_path()
- 7 libraries.module \libraries_get_path()
- 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.
File
- ./
libraries.module, line 21 - External library handling for Drupal modules.
Code
function libraries_get_path($name, $base_path = FALSE) {
static $libraries;
if (!isset($libraries)) {
$libraries = libraries_get_libraries();
}
$path = $base_path ? base_path() : '';
if (!isset($libraries[$name])) {
// Most often, external libraries can be shared across multiple sites, so
// we return sites/all/libraries as the default path.
$path .= 'sites/all/libraries/' . $name;
}
else {
$path .= $libraries[$name];
}
return $path;
}