context_reaction_delta.inc in Delta 7.2
File
plugins/context_reaction_delta.inc
View source
<?php
class context_reaction_delta extends context_reaction {
function options_form($context) {
$values = $this
->fetch_from_context($context);
$form = array(
'#tree' => TRUE,
'#title' => t('Delta Override Template'),
);
$sql = "\n \t SELECT dt.name, dt.system_name, dt.tid \n \t FROM {delta_theme_settings} dt\n \t ORDER BY dt.name ASC";
$result = db_query($sql, array(), array(
'fetch' => PDO::FETCH_ASSOC,
));
$options = array();
foreach ($result as $item) {
$options[$item['system_name']] = $item['name'];
}
$form['delta_template'] = array(
'#type' => 'radios',
'#title' => t('Select Custom theme settings template.'),
'#default_value' => isset($values['delta_template']) ? $values['delta_template'] : '',
'#options' => $options,
);
return $form;
}
function execute(&$vars) {
$contexts = context_active_contexts();
foreach ($contexts as $context) {
if (!empty($context->reactions['delta'])) {
$vars['delta'] = 'theme_delta_' . $context->reactions['delta']['delta_template'] . '_settings';
global $delta_template;
$delta_template = isset($vars['delta']) ? $vars['delta'] : NULL;
}
}
}
}