You are here

function patchinfo_theme_registry_alter in PatchInfo 8.2

Same name and namespace in other branches
  1. 8 patchinfo.module \patchinfo_theme_registry_alter()
  2. 7 patchinfo.module \patchinfo_theme_registry_alter()

Implements hook_theme_registry_alter().

File

./patchinfo.module, line 326
Patch Info primary module file.

Code

function patchinfo_theme_registry_alter(&$theme_registry) {
  $module_path = drupal_get_path('module', 'patchinfo');
  if (isset($theme_registry['update_report'])) {

    // Replace template location for update report with our own templates
    // folder, so that we can alter the template.
    $theme_registry['update_report']['path'] = $module_path . '/templates';
  }
  if (isset($theme_registry['update_project_status'])) {

    // Update module will sort parts of the project information using sort().
    // Unfortunately, this results in the keys being lost. Since we need these
    // keys to check for patch information, we will move our preprocess function
    // in front of the preprocess function provided by update module.
    $position = array_search('patchinfo_preprocess_update_project_status', $theme_registry['update_project_status']['preprocess functions']);
    if ($position) {
      $out = array_splice($theme_registry['update_project_status']['preprocess functions'], $position, 1);
      array_splice($theme_registry['update_project_status']['preprocess functions'], 1, 0, $out);
    }

    // Replace template location for update project status with our own
    // templates folder, so that we can alter the template.
    $theme_registry['update_project_status']['path'] = $module_path . '/templates';
  }
}