We had a case where we needed several subthemes for cti_flex. However the subthemes didn't get all the default stylesheets from the base theme.

This seemed to be a problem with using a path_to_theme() function when including the default styles, resulting that these styles were tried to be looked up from the subtheme directory where they weren't available. Changing path_to_theme() to drupal_get_path() seems to fix this issue.

Index: template.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/cti_flex/template.php,v
retrieving revision 1.1
diff -u -p -r1.1 template.php
--- template.php        21 Aug 2009 20:05:37 -0000      1.1
+++ template.php        3 Sep 2010 06:52:51 -0000
@@ -73,7 +73,7 @@
 
 // Optionally add the fixed width CSS file.
 if (theme_get_setting('cti_flex_fixed')) {
-  drupal_add_css(path_to_theme() . '/fixed-layout.css', 'theme', 'all');
+  drupal_add_css(drupal_get_path('theme', 'cti_flex') . '/fixed-layout.css', 'theme', 'all');
 }
 
 // Optionally add CSS files for the user-selected color design.
@@ -81,13 +81,13 @@ if (theme_get_setting('cti_flex_fixed'))
 $design = theme_get_setting('cti_flex_design');
 switch ($design) {
   case '0':
-    drupal_add_css(path_to_theme() . '/colors/teal.css', 'theme', 'all'); 
+    drupal_add_css(drupal_get_path('theme', 'cti_flex') . '/colors/teal.css', 'theme', 'all'); 
     break;
   case '1':
-    drupal_add_css(path_to_theme() . '/colors/blue.css', 'theme', 'all');
+    drupal_add_css(drupal_get_path('theme', 'cti_flex') . '/colors/blue.css', 'theme', 'all');
     break;
   case '2':
-    drupal_add_css(path_to_theme() . '/colors/red.css', 'theme', 'all'); 
+    drupal_add_css(drupal_get_path('theme', 'cti_flex') . '/colors/red.css', 'theme', 'all'); 
     break;
   case '3':
     break;

Comments

ajross’s picture

Status: Needs review » Active

Excellent point. Will implement in the next release. Thanks so much for figuring out the solution to this.

ajross’s picture

Status: Active » Fixed
ajross’s picture

Status: Fixed » Closed (fixed)