You are here

function dhtml_menu_theme_registry_alter in DHTML Menu 6.3

Same name and namespace in other branches
  1. 8 dhtml_menu.module \dhtml_menu_theme_registry_alter()
  2. 6.4 dhtml_menu.module \dhtml_menu_theme_registry_alter()

Implementation of hook_theme_registry_alter(). Replaces the theme functions for the menu_item functions, and stores the original functions in order to call them when this module is done with preprocessing.

File

./dhtml_menu.module, line 31
dhtml_menu.module Adds preprocessors to the menu theming functions that will add dynamic expansion to their menus.

Code

function dhtml_menu_theme_registry_alter(&$theme_registry) {
  global $theme;

  // Back up the existing theme functions.
  $themes = variable_get('dhtml_menu_theme', array());
  unset($themes[$theme]);
  foreach (array(
    'menu_item',
    'menu_item_link',
  ) as $hook) {
    $intercept = 'function';
    if ($theme_registry[$hook]['function'] == 'devel_themer_catch_function') {
      $intercept = 'devel_function_intercept';
    }
    $themes[$theme][$hook] = $theme_registry[$hook][$intercept];

    // Replace them with our own. These will "preprocess" and call the real functions.
    $theme_registry[$hook][$intercept] = 'dhtml_menu_theme_' . $hook;
  }
  variable_set('dhtml_menu_theme', $themes);
}