You are here

function context_preprocess_page in Context 6.2

Same name and namespace in other branches
  1. 8 context.module \context_preprocess_page()
  2. 6.3 context.core.inc \context_preprocess_page()
  3. 6 context.core.inc \context_preprocess_page()
  4. 7.3 context.core.inc \context_preprocess_page()

Implementation of preprocess_page().

1 string reference to 'context_preprocess_page'
context_theme_registry_alter in ./context.core.inc
Implementation of hook_theme_registry_alter().

File

./context.core.inc, line 713

Code

function context_preprocess_page(&$vars) {
  $info = context_active_values('theme_section');
  $vars['section_title'] = !empty($info['title']) ? check_plain($info['title']) : '';
  $vars['section_subtitle'] = !empty($info['subtitle']) ? check_plain($info['subtitle']) : '';

  // Merge body classes from *any* active contexts.
  $classes = array();
  foreach (context_active_contexts() as $context) {
    if (!empty($context->theme_section['class'])) {
      $classes[$context->theme_section['class']] = $context->theme_section['class'];
    }
  }
  $vars['body_classes'] .= !empty($classes) ? ' ' . check_plain(implode(' ', $classes)) : '';

  // If primary + secondary links are pointed at the same menu, provide
  // contextual trailing by default.
  if (variable_get('menu_primary_links_source', 'primary-links') == variable_get('menu_secondary_links_source', 'secondary-links')) {
    $vars['primary_links'] = theme_get_setting('toggle_primary_links') ? context_menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links')) : $vars['primary_links'];
    $vars['secondary_links'] = theme_get_setting('toggle_secondary_links') ? context_menu_navigation_links(variable_get('menu_secondary_links_source', 'secondary-links'), 1) : $vars['secondary_links'];
  }
  $vars['primary_links'] = theme_get_setting('toggle_primary_links') ? context_menu_set_active($vars['primary_links']) : $vars['primary_links'];
  $vars['secondary_links'] = theme_get_setting('toggle_secondary_links') ? context_menu_set_active($vars['secondary_links']) : $vars['secondary_links'];
  if ($context_links = context_links()) {
    $vars['context_links'] = theme('context_links', $context_links);
  }
}