You are here

function context_theme_registry_alter in Context 7.3

Same name and namespace in other branches
  1. 6.3 context.core.inc \context_theme_registry_alter()
  2. 6 context.core.inc \context_theme_registry_alter()
  3. 6.2 context.core.inc \context_theme_registry_alter()

Implementation of hook_theme_registry_alter().

File

./context.core.inc, line 71

Code

function context_theme_registry_alter(&$theme_registry) {

  // Push theme_page() through a context_preprocess to provide
  // context-sensitive menus and variables. Ensure that
  // context_preprocess_page() comes immediately after
  // template_preprocess_page().
  $position = array_search('context_preprocess_page', $theme_registry['page']['preprocess functions']);
  if ($position !== FALSE) {
    unset($theme_registry['page']['preprocess functions'][$position]);
  }

  // Prevent conflict with i18n_menu.
  if (module_exists('i18n_menu')) {
    $position = array_search('i18n_menu_preprocess_page', $theme_registry['page']['preprocess functions']);
  }
  else {
    $position = array_search('template_preprocess_page', $theme_registry['page']['preprocess functions']);
  }
  $position = $position ? $position + 1 : 2;
  array_splice($theme_registry['page']['preprocess functions'], $position, 0, 'context_preprocess_page');
}