class DynamicBackgroundReaction in Dynamic Background 7
Same name and namespace in other branches
- 6 modules/dynamic_background_context/plugins/dynamic_background_context_reaction.inc \DynamicBackgroundReaction
- 7.2 modules/dynamic_background_context/plugins/dynamic_background_context_reaction.inc \DynamicBackgroundReaction
Hierarchy
- class \context_reaction
- class \DynamicBackgroundReaction
Expanded class hierarchy of DynamicBackgroundReaction
1 string reference to 'DynamicBackgroundReaction'
- dynamic_background_context_context_plugins in modules/
dynamic_background_context/ dynamic_background_context.module - Implements hook_context_plugins().
File
- modules/
dynamic_background_context/ plugins/ dynamic_background_context_reaction.inc, line 3
View source
class DynamicBackgroundReaction extends context_reaction {
function options_form($context) {
$form = array();
$form['dynamic_background'] = array(
'#type' => 'fieldset',
'#title' => t('Dynamic background'),
'#description' => t('Select the image that you want for the current context.'),
'#collapsed' => FALSE,
'#collapsible' => TRUE,
'#tree' => TRUE,
);
// Add the image selection part of the form.
$form['dynamic_background'] += dynamic_background_image_selector_form($this
->find_selected_image($context));
return $form;
}
/**
* Options form submit handler.
*/
function options_form_submit($values) {
// Remove the extra level, that the field set above creates.
return array_pop($values);
}
/**
* Find the selected image and return its id.
*/
function execute() {
$image_id = NULL;
foreach ($this
->get_contexts() as $context) {
$image_id = $this
->find_selected_image($context);
}
return $image_id;
}
function find_selected_image($context) {
// Find the currently selected image
if (isset($context->reactions['dynamic_background'])) {
foreach ($context->reactions['dynamic_background'] as $id => $value) {
if (isset($value['selected']) && $value['selected']) {
return $id;
}
}
}
return NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
context_reaction:: |
property | |||
context_reaction:: |
property | |||
context_reaction:: |
property | |||
context_reaction:: |
function | Retrieve options from the context provided. | 1 | |
context_reaction:: |
function | Retrieve active contexts that have values for this reaction. | ||
context_reaction:: |
function | Settings form. Provide variable settings for your reaction. | 2 | |
context_reaction:: |
function | Clone our references when we're being cloned. | ||
context_reaction:: |
function | Constructor. Do not override. | ||
DynamicBackgroundReaction:: |
function | Find the selected image and return its id. | ||
DynamicBackgroundReaction:: |
function | |||
DynamicBackgroundReaction:: |
function |
Overrides context_reaction:: |
||
DynamicBackgroundReaction:: |
function |
Options form submit handler. Overrides context_reaction:: |