You are here

function advagg_theme_registry_alter in Advanced CSS/JS Aggregation 7.2

Same name and namespace in other branches
  1. 6 advagg.module \advagg_theme_registry_alter()

Implements hook_theme_registry_alter().

Replace template_process_html with _advagg_process_html.

File

./advagg.module, line 1095
Advanced CSS/JS aggregation module.

Code

function advagg_theme_registry_alter(&$theme_registry) {
  if (!isset($theme_registry['html'])) {
    return;
  }

  // Replace core's process function with our own.
  $index = array_search('template_process_html', $theme_registry['html']['process functions']);
  if ($index !== FALSE) {
    $theme_registry['html']['process functions'][$index] = '_advagg_process_html';
  }
  else {

    // Put AdvAgg at the bottom if we can't find the replacement.
    $theme_registry['html']['process functions'][] = '_advagg_process_html';
  }

  // Copy html_tag to html_script_tag.
  $theme_registry['html_script_tag'] = $theme_registry['html_tag'];
  $theme_registry['html_script_tag']['function'] = 'theme_html_script_tag';

  // Fix imce_page.
  if (isset($theme_registry['imce_page'])) {
    $advagg_path = drupal_get_path('module', 'advagg');
    $imce_path = drupal_get_path('module', 'imce');
    if (strpos($theme_registry['imce_page']['path'], $imce_path) !== FALSE) {
      $theme_registry['imce_page']['path'] = $advagg_path . '/tpl';
    }
  }
}