function dynamic_background_load_image_configuration in Dynamic Background 7.2
Same name and namespace in other branches
- 6 dynamic_background.module \dynamic_background_load_image_configuration()
- 7 dynamic_background.module \dynamic_background_load_image_configuration()
Helper function that calls hook_dynamic_background_css().
It sorts the returned image configurations based on weight. This function may be called by more then one preprocessor function, so a static cache applied.
Parameters
type $reset:
Return value
array
3 calls to dynamic_background_load_image_configuration()
- dynamic_background_css in ./
dynamic_background.module - Menu callback function used to generate an body style css with the selected background image. The callback is /background.css.
- dynamic_background_preprocess_html in ./
dynamic_background.module - Implements hook_preprocess_html().
- dynamic_background_preprocess_page in ./
dynamic_background.module - Implements hook_preprocess_page().
File
- ./
dynamic_background.module, line 466 - 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_load_image_configuration(&$vars, $reset = FALSE) {
static $images;
if (!isset($images) || $reset) {
// If images is null, create empty array (as no images may be selected).
if (is_null($images)) {
$images = array();
}
// Call all hook_dynamic_background_css().
foreach (module_implements('dynamic_background_css') as $module) {
$function = $module . '_dynamic_background_css';
$result = $function($vars);
if ($result && is_array($result)) {
// Add weight to the result array.
$result['weight'] = _dynamic_background_get_weight($module);
$images[$module] = $result;
}
}
// Sort images based on weight.
usort($images, 'dynamic_background_revers_weight_cmp');
}
return $images;
}