function context_reaction_template_suggestions::execute in Context 7.3
Add any new template suggestions to the current list.
File
- plugins/
context_reaction_template_suggestions.inc, line 25
Class
- context_reaction_template_suggestions
- Add template suggestions as a context reaction.
Code
function execute(&$vars = NULL) {
// Get the list of contexts associated with this reaction.
$contexts = $this
->get_contexts();
// Iterate through each, and process those with something set.
foreach ($contexts as $context) {
if (isset($context->reactions) && !empty($context->reactions[$this->plugin])) {
// Get the suggestion data entered by the user.
$suggestions = $this
->fetch_from_context($context, 'values');
// Convert it to an list and reverse it (as higher priority items
// should be on the bottom).
$suggestions = array_reverse(explode("\n", $suggestions));
// Append the suggested list to the existing list.
$vars['theme_hook_suggestions'] = array_merge($vars['theme_hook_suggestions'], $suggestions);
}
}
}