You are here

function dynamic_background_active_image in Dynamic Background 7.2

Helper function that findes the currently active image in the context created base on the parameters given.

Parameters

string $type: The extension that the image should be located under.

string $data: Identifier defined by the extension that the image should be located under.

Return value

object An object with fid and uri to the image, if non was found FALSE is returned.

12 calls to dynamic_background_active_image()
DynamicBackgroundReaction::execute in modules/dynamic_background_context/plugins/dynamic_background_context_reaction.inc
Find the selected image and return its id.
dynamic_background_admin_images in includes/backgrounds.admin.inc
The image administation form.
dynamic_background_blog_dynamic_background_css in modules/dynamic_background_blog/dynamic_background_blog.module
Implements hook_dynamic_background_css().
dynamic_background_dynamic_background_css in ./dynamic_background.module
Implements hook_dynamic_background_css().
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.

... See full list

File

./dynamic_background.module, line 791
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_active_image($type = 'default', $data = -1) {
  $query = db_select('dynamic_background_usage', 'dbu');
  $query
    ->join('file_managed', 'fm', 'dbu.fid = fm.fid');
  $query
    ->fields('dbu', array(
    'fid',
  ))
    ->fields('fm', array(
    'uri',
  ))
    ->condition('dbu.type', $type, '=')
    ->condition('data', $data, '=');
  return $query
    ->execute()
    ->fetchObject();
}