You are here

function dynamic_background_dynamic_background_css in Dynamic Background 7.2

Same name and namespace in other branches
  1. 6 dynamic_background.module \dynamic_background_dynamic_background_css()
  2. 7 dynamic_background.module \dynamic_background_dynamic_background_css()

Implements hook_dynamic_background_css().

Default implementation of the hook.

File

./dynamic_background.module, line 264
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_dynamic_background_css($vars) {

  // Get active image.
  $image = dynamic_background_active_image();

  // If no image have been found try to select random image (if configured).
  $image_behaviour = variable_get('dynamic_background_image_behaviour', array());
  if (!$image && (isset($image_behaviour['random']) && $image_behaviour['random'])) {
    $image = dynamic_background_random_image();
  }
  if ($image) {

    // Load image style settings.
    $image_style = variable_get('dynamic_background_image_style', FALSE);
    return array(
      'image' => $image,
      'configuration' => variable_get('dynamic_background_css', array()),
      'image_style' => $image_style ? $image_style['style'] : FALSE,
    );
  }
}