You are here

function DynamicBackgroundReaction::options_form_submit in Dynamic Background 7.2

Same name and namespace in other branches
  1. 6 modules/dynamic_background_context/plugins/dynamic_background_context_reaction.inc \DynamicBackgroundReaction::options_form_submit()
  2. 7 modules/dynamic_background_context/plugins/dynamic_background_context_reaction.inc \DynamicBackgroundReaction::options_form_submit()

Options form submit handler.

Overrides context_reaction::options_form_submit

File

modules/dynamic_background_context/plugins/dynamic_background_context_reaction.inc, line 30
Implements a new context reaction that can be used to set dynamic background images based on context.

Class

DynamicBackgroundReaction
@file Implements a new context reaction that can be used to set dynamic background images based on context.

Code

function options_form_submit($values) {

  // Check if any image have been selected.
  $fid = NULL;
  foreach ($values['dynamic_background'] as $key => $value) {
    if (isset($value['selected']) && $value['selected']) {
      $fid = $key;
      break;
    }
  }

  // Get dynamic background info.
  $info = $values['dynamic_background']['dynamic_background_info'];

  // Update the active background image.
  dynamic_background_set_active($fid, 'context', $info['data']);
  return $values;
}