You are here

function spaces_design_theme_registry_alter in Spaces 6.2

Implementation of hook_theme_registry_alter().

File

spaces_design/spaces_design.module, line 36

Code

function spaces_design_theme_registry_alter(&$theme_registry) {
  if ($position = array_search('spaces_design_preprocess_page', $theme_registry['page']['preprocess functions'])) {
    unset($theme_registry['page']['preprocess functions'][$position]);
  }

  // Find the earliest occurrence of a theme key in the registry, and
  // insert spaces_design preprocessor prior to it.
  global $theme_info, $base_theme_info;
  $position = count($theme_registry['page']['preprocess functions']);
  $namespaces = $base_theme_info + array(
    $theme_info,
  );
  foreach ($namespaces as $info) {
    $found = array_search("{$info->name}_preprocess_page", $theme_registry['page']['preprocess functions']);
    if ($found < $position) {
      $position = $found;
    }
  }
  array_splice($theme_registry['page']['preprocess functions'], $position - 1, 0, 'spaces_design_preprocess_page');
}