You are here

function jqmulti_theme_registry_alter in jQuery Multi 6

Implements hook_theme_registry_alter().

  • If jQuery Update is not present, it makes sure our preprocess function runs after everything else.
  • If jQuery Update is present, it removes our preprocess function, so that hook_jquery_update() can do the work.

File

./jqmulti.module, line 42
Code for the jQuery Multi module.

Code

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

      // If our preprocess function is there already, remove it.
      if ($key = array_search('jqmulti_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.
    if (!module_exists('jquery_update')) {
      $theme_registry['page']['preprocess functions'][] = 'jqmulti_preprocess_page';
    }
  }
}