function _libraries_test_module_callback in Libraries API 7.2
Same name and namespace in other branches
- 7.3 tests/modules/libraries_test_module/libraries_test_module.module \_libraries_test_module_callback()
Sets the '[group] callback' key, where [group] is prepare, detect, or load.
This function is used as a test callback for the all callback groups.
It sets the '[group] callback' (see above) key to 'applied ([part])' where [part] is either 'top-level', 'version x.y' (where x.y is the passed-in version string), 'variant example' (where example is the passed-in variant name), or 'version x.y, variant example' (see above), depending on the part of the library the passed-in library information belongs to.
Parameters
$library: An array of library information, which may be version- or variant-specific. Passed by reference.
$version: The version the library information passed in $library belongs to, or NULL if the passed library information is not version-specific.
$variant: The variant the library information passed in $library belongs to, or NULL if the passed library information is not variant-specific.
6 calls to _libraries_test_module_callback()
- _libraries_test_module_info_callback in tests/
modules/ libraries_test_module/ libraries_test_module.module - Sets the 'info callback' key.
- _libraries_test_module_post_detect_callback in tests/
modules/ libraries_test_module/ libraries_test_module.module - Sets the 'post-detect callback' key.
- _libraries_test_module_post_load_callback in tests/
modules/ libraries_test_module/ libraries_test_module.module - Sets the 'post-load callback' key.
- _libraries_test_module_pre_dependencies_load_callback in tests/
modules/ libraries_test_module/ libraries_test_module.module - Sets the 'pre-dependencies-load callback' key.
- _libraries_test_module_pre_detect_callback in tests/
modules/ libraries_test_module/ libraries_test_module.module - Sets the 'pre-detect callback' key.
File
- tests/
modules/ libraries_test_module/ libraries_test_module.module, line 503 - Tests the library detection and loading.
Code
function _libraries_test_module_callback(&$library, $version, $variant, $group) {
$string = 'applied';
if (isset($version) && isset($variant)) {
$string .= " (version {$version}, variant {$variant})";
}
elseif (isset($version)) {
$string .= " (version {$version})";
}
elseif (isset($variant)) {
$string .= " (variant {$variant})";
}
else {
$string .= ' (top-level)';
}
$library["{$group} callback"] = $string;
// The following is used to test caching of library information.
// Only set the message for the top-level library to prevent confusing,
// duplicate messages.
if (!isset($version) && !isset($variant) && variable_get('libraries_test_module_cache', FALSE)) {
drupal_set_message("The <em>{$group}</em> callback group was invoked.");
}
}