Index: zengine.engine =================================================================== RCS file: /cvs/drupal-contrib/contributions/theme-engines/zengine/Attic/zengine.engine,v retrieving revision 1.1.2.3 diff -u -r1.1.2.3 zengine.engine --- zengine.engine 9 May 2007 01:22:32 -0000 1.1.2.3 +++ zengine.engine 11 May 2007 18:04:00 -0000 @@ -1,5 +1,5 @@ 'fonts.css', 'scope' => 'all'), - array('file' => 'zengine.css', 'scope' => 'all'), - array('file' => 'layout.css', 'scope' => 'all'), - array('file' => 'icons.css', 'scope' => 'all'), - array('file' => 'colors.css', 'scope' => 'all'), - array('file' => 'print.css', 'scope' => 'print'), + $theme_css_path = path_to_theme() .'/css/'; + $engine_css_path = path_to_engine() .'/css/'; + + $css_files = array( + 'zengine' => array('file' => 'zengine.css', 'scope' => 'all'), + 'fonts' => array('file' => 'fonts.css', 'scope' => 'all'), + 'layout' => array('file' => 'layout.css', 'scope' => 'all'), + 'icons' => array('file' => 'icons.css', 'scope' => 'all'), + 'colors' => array('file' => 'colors.css', 'scope' => 'all'), + 'print' => array('file' => 'print.css', 'scope' => 'print'), ); - foreach ($zen_css_files as $css_file) { - if (file_exists(path_to_theme() .'/'. $css_file['file'])) { - $css_path = path_to_theme() .'/'. $css_file['file']; + $css_func = '_'. $theme .'_css'; + if (function_exists($css_func)) { + // allow theme to override css files and/or add its own + $css_func($css_files, $vars); + } + + foreach ($css_files as $css_file) { + $css_path = FALSE; + if ($css_file['path'] && file_exists($css_file['path'] .'/'. $css_file['file'])) { + // if there's a path defined for this rule, look for the file there + // this could allow a theme to look for CSS in the files directory + // dynamic CSS files, anyone? + $css_path = $css_file['path'] .'/'. $css_file['file']; + } + if (file_exists($theme_css_path . $css_file['file'])) { + $css_path = $theme_css_path . $css_file['file']; + } + elseif (file_exists($engine_css_path . $css_file['file'])) { + $css_path = $engine_css_path . $css_file['file']; } - else { - $css_path = path_to_engine() .'/'. $css_file['file']; + if ($css_path) { + $vars['css'] = drupal_add_css($css_path, 'theme', $css_file['scope'] ? $css_file['scope'] : 'all'); } - $vars['css'] = drupal_add_css($css_path, 'theme', $css_file['scope'] ? $css_file['scope'] : 'all'); } - if (file_exists(path_to_theme() .'/style.css')) { - $styles_path = path_to_theme() .'/style.css'; + if (file_exists(path_to_theme() .'/css/style.css')) { + $styles_path = path_to_theme() .'/css/style.css'; } else { - $styles_path = path_to_engine() .'/style.css'; + $styles_path = path_to_engine() .'/css/style.css'; } + // this is a bit of a kludge in order to allow the theme NOT to have its own style.css file + // and also to have style.css load AFTER the other CSS files unset($vars['css']['all']['theme'][$vars['directory'] .'/style.css']); $vars['css']['all']['theme'][$styles_path] = 1; $vars['styles'] = drupal_get_css($vars['css']); @@ -303,5 +319,11 @@ } + // allow theme to add/override variables + $variables_function = '_'. $theme .'_variables'; + if (function_exists($variables_function)) { + $vars = array_merge($vars, call_user_func($variables_function, $hook, $vars)); + } + return $vars; }