You are here

function context_reaction_theme::execute in Context 6.3

Same name and namespace in other branches
  1. 6 plugins/context_reaction_theme.inc \context_reaction_theme::execute()
  2. 7.3 plugins/context_reaction_theme.inc \context_reaction_theme::execute()

Set 'section_title', and 'section_subtitle' if not set and merge all additional classes onto the 'body_classes'.

File

plugins/context_reaction_theme.inc, line 64

Class

context_reaction_theme
Expose themes as context reactions.

Code

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']));
    }
    if (!empty($v->reactions[$this->plugin]['class'])) {
      $classes[$v->reactions[$this->plugin]['class']] = $v->reactions[$this->plugin]['class'];
    }
  }
  $vars['body_classes'] .= !empty($classes) ? ' ' . check_plain(implode(' ', $classes)) : '';
}