You are here

function dynamic_background_context_dynamic_background_css in Dynamic Background 7

Same name and namespace in other branches
  1. 6 modules/dynamic_background_context/dynamic_background_context.module \dynamic_background_context_dynamic_background_css()
  2. 7.2 modules/dynamic_background_context/dynamic_background_context.module \dynamic_background_context_dynamic_background_css()

Implements hook_dynamic_background_css().

File

modules/dynamic_background_context/dynamic_background_context.module, line 90

Code

function dynamic_background_context_dynamic_background_css($vars) {

  // Find the selected image id.
  $image_id = NULL;
  $plugin = context_get_plugin('reaction', 'dynamic_background');
  if ($plugin) {
    $image_id = $plugin
      ->execute();
  }

  // Generate the css based in the image id.
  if (!is_null($image_id)) {
    $backgrounds = variable_get('dynamic_background_images', array());
    if (isset($backgrounds[$image_id]['picture'])) {

      // Load image style settings.
      $image_style = variable_get('dynamic_background_context_image_style', FALSE);
      return array(
        'image' => $backgrounds[$image_id]['picture'],
        'configuration' => variable_get('dynamic_background_context_css', array()),
        'image_style' => $image_style ? $image_style['style'] : FALSE,
      );
    }
  }
}