Index: template.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/zen/template.php,v
retrieving revision 1.27
diff -u -p -r1.27 template.php
--- template.php 14 Aug 2009 15:50:58 -0000 1.27
+++ template.php 24 Aug 2009 09:11:31 -0000
@@ -23,10 +23,8 @@ if (theme_get_setting('zen_rebuild_regis
* Implements HOOK_theme().
*/
function zen_theme(&$existing, $type, $theme, $path) {
- if (!db_is_active()) {
- return array();
- }
- include_once './' . drupal_get_path('theme', 'zen') . '/zen-internals/template.theme-registry.inc';
+ // When #341140 is fixed, replace _zen_path() with drupal_get_path().
+ include_once './' . _zen_path() . '/zen-internals/template.theme-registry.inc';
return _zen_theme($existing, $type, $theme, $path);
}
@@ -112,7 +110,7 @@ function zen_menu_local_tasks() {
function zen_preprocess_page(&$vars, $hook) {
// If the user is silly and enables Zen as the theme, add some styles.
if ($GLOBALS['theme'] == 'zen') {
- include_once './' . drupal_get_path('theme', 'zen') . '/zen-internals/template.zen.inc';
+ include_once './' . _zen_path() . '/zen-internals/template.zen.inc';
_zen_preprocess_page($vars, $hook);
}
// Add conditional stylesheets.
@@ -161,6 +159,30 @@ function zen_preprocess_page(&$vars, $ho
}
/**
+ * Override or insert variables into the maintenance page template.
+ *
+ * @param $vars
+ * An array of variables to pass to the theme template.
+ * @param $hook
+ * The name of the template being rendered ("page" in this case.)
+ */
+function zen_preprocess_maintenance_page(&$vars, $hook) {
+ // If Zen is the maintenance theme, add some styles.
+ if ($GLOBALS['theme'] == 'zen') {
+ include_once './' . _zen_path() . '/zen-internals/template.zen.inc';
+ _zen_preprocess_page($vars, $hook);
+ }
+ // Add conditional stylesheets.
+ elseif (!module_exists('conditional_styles')) {
+ $vars['styles'] .= $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'], '');
+ }
+
+ // Classes for body element. Allows advanced theming based on context
+ // (home page, node of certain type, etc.)
+ $vars['body_classes_array'] = explode(' ', $vars['body_classes']);
+}
+
+/**
* Override or insert variables into the node templates.
*
* @param $vars
@@ -233,7 +255,7 @@ function zen_preprocess_node(&$vars, $ho
* The name of the template being rendered ("comment" in this case.)
*/
function zen_preprocess_comment(&$vars, $hook) {
- include_once './' . drupal_get_path('theme', 'zen') . '/zen-internals/template.comment.inc';
+ include_once './' . _zen_path() . '/zen-internals/template.comment.inc';
_zen_preprocess_comment($vars, $hook);
}
@@ -259,7 +281,7 @@ function zen_preprocess_block(&$vars, $h
$vars['edit_links_array'] = array();
$vars['edit_links'] = '';
if (theme_get_setting('zen_block_editing') && user_access('administer blocks')) {
- include_once './' . drupal_get_path('theme', 'zen') . '/zen-internals/template.block-editing.inc';
+ include_once './' . _zen_path() . '/zen-internals/template.block-editing.inc';
zen_preprocess_block_editing($vars, $hook);
$classes[] = 'with-block-editing';
}
@@ -293,3 +315,20 @@ function zen_id_safe($string) {
}
return $string;
}
+
+/**
+ * Returns the path to the Zen theme.
+ *
+ * drupal_get_filename() is broken; see #341140. When that is fixed in Drupal 6,
+ * replace _zen_path() with drupal_get_path('theme', 'zen').
+ */
+function _zen_path() {
+ static $path = FALSE;
+ if (!$path) {
+ $matches = drupal_system_listing('zen\.info$', 'themes', 'name', 0);
+ if (!empty($matches['zen']->filename)) {
+ $path = dirname($matches['zen']->filename);
+ }
+ }
+ return $path;
+}
Index: zen-internals/template.conditional-styles.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/zen/zen-internals/template.conditional-styles.inc,v
retrieving revision 1.1
diff -u -p -r1.1 template.conditional-styles.inc
--- zen-internals/template.conditional-styles.inc 12 Aug 2009 06:49:47 -0000 1.1
+++ zen-internals/template.conditional-styles.inc 24 Aug 2009 09:11:31 -0000
@@ -3,7 +3,7 @@
// it has been spun out to its own separate module, It would be nice to prevent
// code drift between the Zen implementation and the conditional_styles.module,
// so Zen now includes an exact copy of conditonal_style module's:
-// conditional_styles.theme.inc,v 1.5 2009/05/25 14:33:03 johnalbin Exp
+// conditional_styles.theme.inc,v 1.6 2009/08/24 08:57:32 johnalbin Exp
/**
* @file
@@ -47,7 +47,7 @@ function _conditional_styles_theme($exis
$themes = list_themes();
foreach (array_keys($themes) AS $theme) {
// We only need to process active themes.
- if ($themes[$theme]->status) {
+ if ($themes[$theme]->status || $GLOBALS['theme'] == $theme) {
$paths = conditional_styles_paths_to_basetheme($theme);
// Grab all the conditional stylesheets.
Index: zen-internals/template.theme-registry.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/zen/zen-internals/template.theme-registry.inc,v
retrieving revision 1.1
diff -u -p -r1.1 template.theme-registry.inc
--- zen-internals/template.theme-registry.inc 12 Aug 2009 06:49:47 -0000 1.1
+++ zen-internals/template.theme-registry.inc 24 Aug 2009 09:11:31 -0000
@@ -14,7 +14,7 @@
function _zen_theme(&$existing, $type, $theme, $path) {
// Compute the conditional stylesheets.
if (!module_exists('conditional_styles')) {
- include_once './' . drupal_get_path('theme', 'zen') . '/zen-internals/template.conditional-styles.inc';
+ include_once './' . _zen_path() . '/zen-internals/template.conditional-styles.inc';
// _conditional_styles_theme() only needs to be run once.
if ($theme == 'zen') {
_conditional_styles_theme($existing, $type, $theme, $path);
@@ -28,7 +28,7 @@ function _zen_theme(&$existing, $type, $
// If we are auto-rebuilding the theme registry, warn about the feature.
// Always display the warning in the admin section, otherwise limit to three
// warnings per hour.
- if (user_access('administer site configuration') && theme_get_setting('zen_rebuild_registry') && $theme == $GLOBALS['theme'] && (arg(0) == 'admin' || flood_is_allowed($GLOBALS['theme'] . '_rebuild_registry_warning', 3))) {
+ if (function_exists('user_access') && user_access('administer site configuration') && theme_get_setting('zen_rebuild_registry') && $theme == $GLOBALS['theme'] && (arg(0) == 'admin' || flood_is_allowed($GLOBALS['theme'] . '_rebuild_registry_warning', 3))) {
flood_register_event($GLOBALS['theme'] . '_rebuild_registry_warning');
drupal_set_message(t('For easier theme development, the theme registry is being rebuilt on every page request. It is extremely important to turn off this feature on production websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning', FALSE);
}
Index: zen-internals/template.zen.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/zen/zen-internals/template.zen.inc,v
retrieving revision 1.2
diff -u -p -r1.2 template.zen.inc
--- zen-internals/template.zen.inc 24 Aug 2009 09:08:22 -0000 1.2
+++ zen-internals/template.zen.inc 24 Aug 2009 09:11:31 -0000
@@ -16,7 +16,7 @@
* If the user is silly and enables Zen as the theme, manually add some stylesheets.
*/
function _zen_preprocess_page(&$vars, $hook) {
- $directory = drupal_get_path('theme', 'zen') . '/zen-internals/css';
+ $directory = _zen_path() . '/zen-internals/css';
// Add default styles.
if (theme_get_setting('zen_layout') == 'zen-columns-fixed') {