diff --git a/includes/theme.inc b/includes/theme.inc index cd65d7d..05ea943 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -202,7 +202,14 @@ function _drupal_theme_initialize($theme, $base_theme = array(), $registry_callb } // Initialize all themes and engines. - foreach (array_merge($base_theme, array($theme)) as $current) { + // Make sure we do not load the same theme engine twice. + $theme_init = array(); + foreach (list_themes() as $current) { + $key = $current->owner . ' ' . $current->engine; + if (isset($theme_init[$key])) { + continue; + } + if (isset($current->owner)) { include_once DRUPAL_ROOT . '/' . $current->owner; } @@ -211,6 +218,7 @@ function _drupal_theme_initialize($theme, $base_theme = array(), $registry_callb call_user_func($current->engine . '_init', $current); } } + $theme_init[$key] = $current; } if (isset($registry_callback)) {