write context settings into a .info file

nflowers1228's picture

I'm trying to find an example of how to write Context settings into the .info file for the sub-theme. We have multiple sub themes and deltas to define the home page as being different from the other pages. One of the home pages has a different layout, so we need 2 deltas. home page context to control the layout. for example:
We have a "Boxed" theme which is 3 columns and a 2 column Home page for that theme as a delta. The other 3 column theme is configured differently but we want the home page to also have only 2 columns so we have another Delta for that one. We've created 2 contexts for the home page based on the path, and using these Deltas. The problem is if someone changes the theme, they would have to go in and change the Context as well so we'd like to automate this so that the context for the home page is part of the theme somehow. Is this possible? Has anyone else tried to do this?

Comments

I think maybe I should reword

nflowers1228's picture

I think maybe I should reword this. How do I get one context to change when the theme is changed, without someone having to go to Structure > Context and clicking on enable. We have multiple themes and a front page context for each one. Want to avoid as many steps as possible.

Nancy Flowers-Mangs
Office of Public Affairs and Communications
Yale University, New Haven, CT

theme condition within context?

drew reece's picture

It sounds like you are asking for a 'theme condition' within context.
Maybe take a look at the context/plugins/context_condition_sitewide.inc or context_condition_node.inc. It may be possible to make a condition to do the theme detection. It looks like the plugins are also defined within context.plugins.inc, so look in there if you want to try making one.

I suspect you will get help in the context issue queue, I don't know if other modules can provide contexts, but it would be worth a look or asking in the queue.

I also wonder if you can use the context condition instead, (assuming you have one set on each different front page).

Thanks! I just found this

nflowers1228's picture

Thanks! I just found this module and will give it a try. not sure if that's the one you are talking about. I'll let you know if that works
http://drupal.org/project/context_condition_theme

Nancy Flowers-Mangs
Office of Public Affairs and Communications
Yale University, New Haven, CT

The one I was talking about

drew reece's picture

The one I was talking about was made up entirely in my head :) I thought you would have to code it yourself. I'm glad you found that, it looks about right.

Anyone looking to assign a

nflowers1228's picture

Anyone looking to assign a context to a specific theme, this module does the trick! http://drupal.org/project/context_condition_theme
When this module is enabled, Theme shows up as a condition and you can choose which theme you want to assign the context to. Works great for assigning a different front page to a site.

Nancy Flowers-Mangs
Office of Public Affairs and Communications
Yale University, New Haven, CT

Omega Framework

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week