function _dynamic_background_get_weight in Dynamic Background 7
Same name and namespace in other branches
- 7.2 dynamic_background.module \_dynamic_background_get_weight()
Gets the weight of the extension/module.
@TODO Implement static cache.
Parameters
string $module: The name of module/extension to get weight for.
Return value
int The module/extension weight.
1 call to _dynamic_background_get_weight()
- dynamic_background_load_image_configuration in ./
dynamic_background.module - Helper function that calls hook_dynamic_background_css() and sorts the returned image configurations based on weight. This function may be called by more then one preprocessor function, so a static cache applied.
File
- ./
dynamic_background.module, line 229 - This module enables administrators to upload images used as background on the site. The selected background image link is exposed as either $background in the page.tpl file or as /background.css.
Code
function _dynamic_background_get_weight($module) {
// Load administrator values
$weights = variable_get('dynamic_background_weight', array());
// Find weights sat by the administratio UI.
foreach ($weights as $weight) {
if ($weight['name'] == $module) {
// Weight found for the module.
return $weight['weight'];
}
}
// Try to get the weight from hook_dynamic_background_weight().
$function = $module . '_dynamic_background_weight';
if (function_exists($function)) {
$result = $function();
return $result['weight'];
}
// No weight was found, so nutral weight returned.
return 0;
}