You are here

function accordions_theme_registry_alter in Accordions 7

Implements hook_theme_registry_alter().

The theme registry is cached so we don't need to add any caching to our processing.

File

./accordions.module, line 52

Code

function accordions_theme_registry_alter(&$theme_registry) {

  // Disable any hooks for disabled accordion types.
  $disabled_types = accordions_get_types(FALSE);
  foreach ($disabled_types as $type_info) {
    if (!empty($type_info['theme hooks'])) {
      foreach ($type_info['theme hooks'] as $hook => $stages) {
        foreach ($stages as $stage => $functions) {
          foreach ($functions as $function) {
            $pos = array_search($function, $theme_registry[$hook][$stage], TRUE);
            if ($pos !== FALSE) {
              unset($theme_registry[$hook][$stage][$pos]);
            }
          }
        }
      }
    }
  }
}