Posted by CraigBertrand on December 15, 2009 at 6:28am
Hey Guys,
I am working on my first multi-language site and we are using zen for our theme.
2010.gateway.org.hk (In heavy Development)
I was having a really hard time getting language classes so I could theme differently for each language and so I headed to irc.
A really helpful guy named (irc nickname) Cvelde wrote some code for template.php so I could get those classes in my site.
http://pastebin.com/f7637b1ab (also attached below)
The code goes write after "classes[] = 'with-wireframes'; // Optionally add the wireframes style..."
So my question/suggestion is should this be added into zentheme core?
If not then at least this post should help others with the same problem.
| Attachment | Size |
|---|---|
| template.php_.txt | 9.13 KB |

Comments
I think it's a good idea. Do
I think it's a good idea. Do you know how to create patches? You should make one and submit it to Zen's issue queue.
The Boise Drupal Guy!
Don't know how to make a patch...
I could try to figure it out though.
However I was wondering if this functionality should be in the i18n module. It seems folks using other themes would need this fairly often. Perhaps I will raise a discussion there.
Craig Bertrand
Definitely an i18n patch
I definitely think it would be more appropriate as a patch for i18n. Like you say, the need for this relates directly to the use of the module instead the Zen theme.
I went ahead and made a patch
I went ahead and made a patch to i18n to do this. Here's the issue. Please review it if you can.
While it works great with Zen subthemes, unfortunately it won't work for Garland/Minelli. Argh.
The Boise Drupal Guy!
Thanks
Thanks Garrett,
I hope they will be able to figure out a way to make it work for all themes. Isn't there a hook somewhere that modules can add css classes/ids to the system before the theme even gets called? I am just a themer and drupal configure-er so I don't know if this is possible but It should be.
Anyhow thanks for taking the initiative to write the patch and submit it!
Craig
Craig Bertrand
Isn't there a hook somewhere
Not that I know of. You might be thinking of something in the direction of drupal_add_css() , but that's for adding CSS files, not classes or anything like that.
The Boise Drupal Guy!
Yeah thats it.
Yeah the "drupal_add_css" is what I had seen before.
I wonder why this feature isn't there?
Craig Bertrand
Fixed in Drupal 7
In Drupal 7, we've added a $classes_array variable (look familiar?) available in each preprocess function and you can modify/add to those classes. The $classes_array gets flattened automatically to a $classes string used in the corresponding template itself.
- John (JohnAlbin)
That should do it :)
Looks like you guys were one step ahead.
Craig Bertrand