View source
<?php
function dynamic_background_context_settings_form() {
$form = array();
$form += dynamic_background_image_style_form('dynamic_background_context_image_style');
$form += dynamic_background_image_behaviour_form('dynamic_background_context_image_behaviour');
return $form;
}
function dynamic_background_context_context_plugins() {
return array(
'dynamic_background_context_reaction' => array(
'handler' => array(
'path' => drupal_get_path('module', 'dynamic_background_context') . '/plugins',
'file' => 'dynamic_background_context_reaction.inc',
'class' => 'DynamicBackgroundReaction',
'parent' => 'context_reaction',
),
),
);
}
function dynamic_background_context_context_registry() {
return array(
'reactions' => array(
'dynamic_background' => array(
'title' => t('Dynamic background'),
'description' => t('Enable different backgrounds base on a given context.'),
'plugin' => 'dynamic_background_context_reaction',
),
),
);
}
function dynamic_background_context_dynamic_background_css($vars) {
$image = FALSE;
$plugin = context_get_plugin('reaction', 'dynamic_background');
if ($plugin) {
$image = $plugin
->execute();
}
if ($image) {
$image_style = variable_get('dynamic_background_context_image_style', FALSE);
return array(
'image' => $image,
'configuration' => variable_get('dynamic_background_context_css', array()),
'image_style' => $image_style ? $image_style['style'] : FALSE,
'weight' => 225,
);
}
}
function dynamic_background_context_dynamic_background_info() {
return array(
'type' => 'context',
'menu' => array(
'title' => t('Context'),
'description' => t('Configure context extension'),
),
'upload' => FALSE,
);
}
function dynamic_background_context_dynamic_background_weight() {
return array(
'weight' => -50,
);
}