context_reaction_template_suggestions.inc in Context 7.3
File
plugins/context_reaction_template_suggestions.inc
View source
<?php
class context_reaction_template_suggestions extends context_reaction {
function options_form($context) {
$default_value = $this
->fetch_from_context($context);
return array(
'#title' => t('Template suggestions'),
'#type' => 'textarea',
'#description' => t('Enter template suggestions such as "page__front", one per line, in order of preference (using underscores instead of hyphens). For more information, please visit <a href="@template-suggestions">Drupal 7 Template (Theme Hook) Suggestions</a>.', array(
'@template-suggestions' => 'http://drupal.org/node/1089656',
)),
'#default_value' => is_string($default_value) ? $default_value : '',
);
}
function execute(&$vars = NULL) {
$contexts = $this
->get_contexts();
foreach ($contexts as $context) {
if (isset($context->reactions) && !empty($context->reactions[$this->plugin])) {
$suggestions = $this
->fetch_from_context($context, 'values');
$suggestions = array_reverse(explode("\n", $suggestions));
$vars['theme_hook_suggestions'] = array_merge($vars['theme_hook_suggestions'], $suggestions);
}
}
}
}