Commit e6f845f4 authored by tstoeckler's avatar tstoeckler

Issue #958162 by sun, tstoeckler: Make tests debuggable and provide libraries_info_defaults().

parent 9022ed7d
Libraries 7.x-2.x, xxxx-xx-xx
-----------------------------
#958162 by sun, tstoeckler: Make tests debuggable and provide libraries_info_defaults().
#961476 by tstoeckler: Changed libraries_get_path() to return FALSE by default.
#958162 by tstoeckler, sun, good_man: Allow to apply callbacks to libraries.
#1125904 by tstoeckler, boombatower: Fix drush libraries-list.
......
......@@ -244,26 +244,7 @@ function libraries_info($name = NULL) {
// Provide defaults.
foreach ($libraries as $machine_name => &$properties) {
$properties += array(
'machine name' => $machine_name,
'name' => $machine_name,
'vendor url' => '',
'download url' => '',
'path' => '',
'library path' => NULL,
'version callback' => 'libraries_get_version',
'version arguments' => array(),
'files' => array(),
'variants' => array(),
'versions' => array(),
'integration files' => array(),
'callbacks' => array(),
);
$properties['callbacks'] += array(
'prepare' => array(),
'detect' => array(),
'load' => array(),
);
libraries_info_defaults($properties, $machine_name);
}
// Allow modules to alter the registered libraries.
......@@ -281,6 +262,38 @@ function libraries_info($name = NULL) {
return $libraries;
}
/**
* Applies default properties to a library definition.
*
* @library
* An array of library information, passed by reference.
* @name
* The machine name of the passed-in library.
*/
function libraries_info_defaults(&$library, $name) {
$library += array(
'machine name' => $name,
'name' => $name,
'vendor url' => '',
'download url' => '',
'path' => '',
'library path' => NULL,
'version callback' => 'libraries_get_version',
'version arguments' => array(),
'files' => array(),
'variants' => array(),
'versions' => array(),
'integration files' => array(),
'callbacks' => array(),
);
$library['callbacks'] += array(
'prepare' => array(),
'detect' => array(),
'load' => array(),
);
return $library;
}
/**
* Tries to detect a library and its installed version.
*
......
This diff is collapsed.
......@@ -240,10 +240,6 @@ function libraries_test_libraries_info() {
'load callback' => 'not applied',
);
// This library is used together with libraries_info() to be populated with
// the defaults.
$libraries['example_empty'] = array();
return $libraries;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment