I've created a Zen subtheme that works well. Now I want to create sub-subthemes that inherit from the base subtheme, which include a few minor overrides (e.g. background & font color changes). The intent is to have different sections of the site to have slightly different looks (via organic groups).
In 0.7, it was as simple as creating a sub folder in the subtheme's folder and putting in a tiny style.css file that imports the parent's style.css along with the changes that were being overridden. It "just worked" and Drupal recognized the sub-subtheme automatically.
What is the proper way to do this in 1.0? Should a sub-subtheme folder be placed inside the subtheme folder? Or should it be placed in the zen folder also? What other files need to be changed? I could not find any documentation anywhere that referred to sub-subthemes. I'd hate to clone the whole subtheme as that defeats the purpose of inheritance, resulting in multiple files to make tweaks.
Thanks for any help....
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | preprocess hooks for subsubthemes.diff | 722 bytes | dellintosh |
| #12 | SUBSUBTHEME.zip | 50.23 KB | dellintosh |
| #12 | subsubtheme support in STARTERKIT theme-settings.diff | 539 bytes | dellintosh |
| #8 | zen sub-sub-theme support.diff | 1.37 KB | dellintosh |
| #6 | SUBSUBTHEME.zip | 51.14 KB | dellintosh |
Comments
Comment #1
guardian commentedi would like to know as well
Comment #2
wickwood commentedI recently purchased Drupal 5 Themes by Packt Publishing, and chapter 6 is an example based on using sub-subthemes of Zen. Obviously much has changed since this book was written and finally published with this theme, and I'm trying to figure out how those changes now work.
Thanks.
Comment #3
johnalbinI have no idea if sub-sub-themes work in 5.x-1.x. I would suspect that they don't work at all.
Just trying to get sub-themes to work Zen 5.x-1.x was an tricky; I would bet trying to support multi-level sub-themes would be futile. Sorry. :-(
Comment #4
CheckeredFlag commentedI took a stab at implementing sub-sub-themes. I've just started using it and it seems to work well so far. Note that only CSS overrides have been tested.
I cloned the STARTERKIT folder and renamed it to SUBSUBTHEME and included a README.txt that is very similar to one for creating a sub-theme.
I would appreciate it if others could take a look at it (John???) and see if there may be any potential pitfalls in the code (primarily in template.php) or if there ways it could be improved.
Simply unzip the attached file and place the SUBSUBTHEME folder in your Zen folder and follow the directions in its README.txt.
Comment #5
dellintosh commentededit: Fixed now! :) See patch file below for newest fixes.
I applied the above patch and can verify that the _preprocess functions do work; however, I'm having difficulty defining the regions for the sub-subtheme. I'm just wanting to inherit them from my subtheme, but can't get it working.
I've tried doing (where subsubtheme and subtheme are named as appropriate):
Any thoughts? I know that the function subsubtheme_regions() is firing, and print_r(subsubtheme_regions()); gives me what I'd expect: an array of regions, but it keeps defaulting back to only a right sidebar and left sidebar; nothing else.
Thank you in advance for any help. :D
-dellintosh
Comment #6
dellintosh commentedCheckeredFlag,
First off, awesome job on putting this together. I've done just a few enhancements to the subsubtheme, and thoroughly tested the page.tpl.php and other *.tpl.php override functionality and it works beautifully! I've also tested the template.php file and discovered that this fully supports template.php overrides as well as sending preprocess_page (and other preprocess) variables to our theme. I set up regions to be inherited from the STARTERKIT sub-theme (since we're recommending a find/replace for those words I made it an easy task for users). Regions can also be defined separately within the SUBSUBTHEME_regions() function. :D
All in all, the most amazing part is that the core zen files didn't have to be affected! :D Great job John on building it that way, even though you mentioned you didn't really plan that part. :D
Hopefully this looks good to you, John, and I look forward to seeing it appear in 5.x-1.2... :D hehe..
-dellintosh
Comment #7
dellintosh commentedapplied the above patch for 5.x-1.1, but since it doesn't change the core files any it should work good for 1.x-dev. I can test it this weekend if I get a chance just to make sure nothing breaks. ;)
Comment #8
dellintosh commentedOkay, so after further evaluation of this method, I've discovered that it misses something fairly critical. If you set up a special *.tpl.php file within the SUBSUBTHEME folder, it works. However, if you want to "inherit" the *.tpl.php file (natively) from the STARTERKIT folder, it doesn't work automagically as well as the sub-theme overrides do. So I did have to add a *very small* patch to the zen core/template-subtheme.php file.
I'm attaching the patch for zen/template-subtheme.php, and I hope that it looks good for addition too. I tested that this patch still works when enabling a sub-theme (not the subsubtheme) and everything still works as expected.
-dellintosh
Comment #9
SeanBannister commentedJust putting in my support for this functionality, haven't had a chance to test this but can I suggest (if it doesn't already) that sub-subtheme directories can be placed inside the subthemes directory and not just in the Zen directory. This will make it easier to manage large theme installs.
Comment #10
SeanBannister commentedOk, might want to ignore my comment I just installed the 6.x zen theme and realised that subthemes no longer reside in the zen folder as in Drupal 5.
Comment #11
CheckeredFlag commentedGlad you were able to resolve your issue, dellintosh! My experience with themes has been limited to little more than CSS and maybe a .tpl.php file. I've never tinkered with custom regions or functions so you were talking over my head.
Thanks for your contribution! Hopefully this may make it into a future release that will help others.
Comment #12
dellintosh commentedSeanBannister -
Just so you know this patch is targeted for Zen 5.x, not 6.x. I know the theming system is very different between versions, so the procedures in this would need to be adjusted to work with 6.x.
CheckeredFlag -
Thank you, my client is enjoying the sub-sub-theme setup so far, and having the additional level of control over the .tpl.php files as well as defining custom variables and overrides inside the sub-sub-theme template.php file is great!
I have discovered a few new items of note: I'm working on getting the theme-settings.php to properly inherit the settings from the parent sub-theme (and zen as well), although since that part might be more "edge" case perhaps it's not as big of a deal for others. I'm attaching the new SUBSUBTHEME folder, as well as a patch for STARTERKIT/theme-settings.php which provides sub-subtheme support.
Comment #13
johnalbinFYI: an unlimited level of sub-themes of sub-themes is supported by Drupal 6 core. So, all the sub-theme support that was in Zen 5.x has been ripped out of Zen 6.x since it is no longer needed.
Comment #14
dellintosh commentedOkay, another little bug I found with the sub-sub-themes. The attached patch adds (complete) support for preprocess hooks within the sub-theme and sub-sub-theme's template.php file. I did have to apply this patch to the core zen/template.php file, but it's a fairly minor change so hopefully it meets your requirements, John. :)
PS: I've also tested this with regular sub-themes and still works as expected. :)
Thank you again,
-dellintosh
Comment #15
akalata commentedClosing - no activity in 2 years.