function dynamic_background_load_image_configuration in Dynamic Background 7
Same name and namespace in other branches
- 6 dynamic_background.module \dynamic_background_load_image_configuration()
- 7.2 dynamic_background.module \dynamic_background_load_image_configuration()
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.
@staticvar type $images
Parameters
type $reset:
Return value
type
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 - Page preprocess function used to create the $background variable, so it can be used in html.tpl.php. If selected have selected to use custom CSS, the image will automatically be added to the page header.
- dynamic_background_preprocess_page in ./
dynamic_background.module - Page preprocess function used to create the $background variable, so it can be used in page.tpl.php
File
- ./
dynamic_background.module, line 194 - 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();
}
// Implementation of 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 and get images with highest weight.
usort($images, 'dynamic_background_revers_weight_cmp');
}
return $images;
}