diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 16 | ||||
-rw-r--r-- | includes/theme.maintenance.inc | 9 |
2 files changed, 23 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc index 90be49c5a..2a93e7999 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -4520,6 +4520,22 @@ function drupal_alter($type, &$data, &$context1 = NULL, &$context2 = NULL) { $function = $module . '_' . $hook; $function($data, $context1, $context2); } + // Allow the theme to alter variables after the theme system has been + // initialized. + global $theme, $base_theme_info; + if (isset($theme)) { + $theme_keys = array(); + foreach ($base_theme_info as $base) { + $theme_keys[] = $base->name; + } + $theme_keys[] = $theme; + foreach ($theme_keys as $theme_key) { + $function = $theme_key . '_' . $hook; + if (function_exists($function)) { + $function($data, $context1, $context2); + } + } + } } /** diff --git a/includes/theme.maintenance.inc b/includes/theme.maintenance.inc index a625e15c0..5ba1ee3ac 100644 --- a/includes/theme.maintenance.inc +++ b/includes/theme.maintenance.inc @@ -33,7 +33,7 @@ function _drupal_maintenance_theme() { // Install and update pages are treated differently to prevent theming overrides. if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) { - $theme = 'minnelli'; + $custom_theme = 'minnelli'; } else { if (!db_is_active()) { @@ -46,11 +46,16 @@ function _drupal_maintenance_theme() { drupal_load('module', 'filter'); } - $theme = variable_get('maintenance_theme', 'minnelli'); + $custom_theme = variable_get('maintenance_theme', 'minnelli'); } $themes = list_themes(); + // list_themes() triggers a drupal_alter() in maintenance mode, but we can't + // let themes alter the .info data until we know a theme's base themes. So + // don't set global $theme until after list_themes() builds its cache. + $theme = $custom_theme; + // Store the identifier for retrieving theme settings with. $theme_key = $theme; |