You are here

function jquery_update_theme_registry_alter in jQuery Update 6.2

Same name and namespace in other branches
  1. 6 jquery_update.module \jquery_update_theme_registry_alter()

Implementation of hook_theme_registry_alter().

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

File

./jquery_update.module, line 62
Updates Drupal to use the latest version of jQuery.

Code

function jquery_update_theme_registry_alter(&$theme_registry) {
  if (isset($theme_registry['page'])) {
    if (count($theme_registry['page']['preprocess functions']) > 0) {

      // If jquery_update's preprocess function is there already, remove it.
      if ($key = array_search('jquery_update_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'][] = 'jquery_update_preprocess_page';
  }
}