context_reaction_theme.inc in Context 7.3
File
plugins/context_reaction_theme.inc
View source
<?php
class context_reaction_theme extends context_reaction {
function editor_form($context) {
$form = $this
->options_form($context);
unset($form['title']['#description']);
unset($form['subtitle']['#description']);
unset($form['class']['#description']);
return $form;
}
function editor_form_submit($context, $values) {
return $values;
}
function options_form($context) {
$values = $this
->fetch_from_context($context);
$form = array(
'#tree' => TRUE,
'#title' => t('Theme variables'),
'title' => array(
'#title' => t('Section title'),
'#description' => t('Provides this text as a <strong>$section_title</strong> variable for display in page.tpl.php when this context is active.'),
'#type' => 'textfield',
'#maxlength' => 255,
'#default_value' => isset($values['title']) ? $values['title'] : '',
),
'subtitle' => array(
'#title' => t('Section subtitle'),
'#description' => t('Provides this text as a <strong>$section_subtitle</strong> variable for display in page.tpl.php when this context is active.'),
'#type' => 'textfield',
'#maxlength' => 255,
'#default_value' => isset($values['subtitle']) ? $values['subtitle'] : '',
),
);
return $form;
}
function execute(&$vars) {
$classes = array();
foreach ($this
->get_contexts() as $k => $v) {
if (!empty($v->reactions[$this->plugin]['title']) && !isset($vars['section_title'])) {
$vars['section_title'] = check_plain(t($v->reactions[$this->plugin]['title']));
}
if (!empty($v->reactions[$this->plugin]['subtitle']) && !isset($vars['section_subtitle'])) {
$vars['section_subtitle'] = check_plain(t($v->reactions[$this->plugin]['subtitle']));
}
}
}
}