function libraries_detect_dependencies in Libraries API 7.3
Same name and namespace in other branches
- 8.3 libraries.module \libraries_detect_dependencies()
- 7.2 libraries.module \libraries_detect_dependencies()
Library post-detect callback to process and detect dependencies.
It checks whether each of the dependencies of a library are installed and available in a compatible version.
Parameters
$library: An associative array of library information or a part of it, passed by reference.
$version: If the library information belongs to a specific version, the version string. NULL otherwise.
$variant: If the library information belongs to a specific variant, the variant name. NULL otherwise.
See also
1 call to libraries_detect_dependencies()
1 string reference to 'libraries_detect_dependencies'
- libraries_info_defaults in ./
libraries.module - Applies default properties to a library definition.
File
- ./
libraries.module, line 342 - External library handling for Drupal modules.
Code
function libraries_detect_dependencies(&$library, $version = NULL, $variant = NULL) {
if (isset($library['dependencies'])) {
foreach ($library['dependencies'] as &$dependency_string) {
$dependency_info = drupal_parse_dependency($dependency_string);
$dependency = libraries_detect($dependency_info['name']);
if (!$dependency['installed']) {
$library['installed'] = FALSE;
$library['error'] = 'missing dependency';
$library['error message'] = t('The %dependency library, which the %library library depends on, is not installed.', array(
'%dependency' => $dependency['name'],
'%library' => $library['name'],
));
}
elseif (drupal_check_incompatibility($dependency_info, $dependency['version'])) {
$library['installed'] = FALSE;
$library['error'] = 'incompatible dependency';
$library['error message'] = t('The version %dependency_version of the %dependency library is not compatible with the %library library.', array(
'%dependency_version' => $dependency['version'],
'%dependency' => $dependency['name'],
'%library' => $library['name'],
));
}
// Remove the version string from the dependency, so libraries_load() can
// load the libraries directly.
$dependency_string = $dependency_info['name'];
}
}
}