You are here

function labjs_theme_registry_alter in LABjs 6

Implementation of hook_theme_registry_alter().

Make LABjs's page preprocess function run *after* everything else's, so that a theme can't call drupal_get_js() and mess everything up, and other JS/CSS replacement modules can work with LABjs.

File

./labjs.module, line 44
LABjs module

Code

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

      // If labjs's preprocess function is there already, remove it.
      if ($key = array_search('labjs_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'][] = 'labjs_preprocess_page';
  }
  if (!(module_exists('advagg') && variable_get('advagg_enabled', ADVAGG_ENABLED) && variable_get('advagg_closure', ADVAGG_CLOSURE))) {
    $theme_registry['closure']['function'] = 'labjs_closure';
  }
}