function dynamic_background_load_images in Dynamic Background 7.2
Helper function that loads all images in a given context based on the parameters passed.
Parameters
string $extension: The extension that the image should be found under.
mixed $data: Identifier defined by the extension that the image should be located under.
bool $reset: Used to by pass the static cache.
Return value
array Array of files indexed by fid and containing file uri's.
3 calls to dynamic_background_load_images()
- dynamic_background_admin_images in includes/
backgrounds.admin.inc - The image administation form.
- dynamic_background_image_selector_form in ./
dynamic_background.module - Builds image selection part of a form to be used by sub-moduels, where the user may select background images.
- dynamic_background_user_upload_form in ./
dynamic_background.module - Hepler function that build an upload form, which can be used by sub-modules to allow uploading of files.
File
- ./
dynamic_background.module, line 850 - 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_images($extension = 'default', $data = -1, $reset = FALSE) {
static $images;
if (!$images || !isset($images[$extension . $data]) || $reset) {
$query = db_select('dynamic_background_images', 'dbi');
$query
->join('file_managed', 'fm', 'dbi.fid = fm.fid');
$query
->fields('dbi', array(
'fid',
))
->fields('fm', array(
'uri',
))
->condition('extension', $extension)
->condition('data', $data);
$result = $query
->execute();
if ($result) {
$files = array();
foreach ($result as $row) {
$files[$row->fid] = $row->uri;
}
$images[$extension . $data] = $files;
}
}
return $images[$extension . $data];
}