You are here

function _cdn_fallback_theme_registry_alter in CDN 6.2

Implementation of hook_theme_registry_alter().

Make CDN's page preprocess function run *after* everything else's, so that a theme can't call drupal_get_js() and mess everything up.

Parameters

&$theme_registry: The entire cache of theme registry information, post-processing.

1 call to _cdn_fallback_theme_registry_alter()
cdn_theme_registry_alter in ./cdn.module
Implementation of hook_theme_registry_alter().

File

./cdn.fallback.inc, line 24
Fallback when hook_file_url_alter() is not available (i.e. when the core patch is not installed or when not using a patched Drupal distribution): use the Parallel module's logic (with some adaptations to be able to use the CDN module's logic…

Code

function _cdn_fallback_theme_registry_alter(&$theme_registry) {
  if (isset($theme_registry['page'])) {

    // If CDN's preprocess function is there already, remove it.
    if ($key = array_search('cdn_preprocess_page', $theme_registry['page']['preprocess functions'])) {
      unset($theme_registry['page']['preprocess functions'][$key]);
    }

    // Now tack it on at the end so it runs after everything else.
    $theme_registry['page']['preprocess functions'][] = 'cdn_preprocess_page';
  }
}