If this module could implement the raw theme change into an action, then the desired effect would be much more extensible using modules like Rules or Trigger. Rules already has an awesome UI, so this would fit very nicely.

Comments

sun’s picture

I'd rather like to see this in http://drupal.org/project/switchtheme

mitchell’s picture

@sun: Either way, we don't need another UI module or a block; all we need is an action to switch the theme.

mitchell’s picture

Project: ThemeKey » Rules
Component: Code / API » Rules Engine
Issue tags: -rules integration, -theming

Moving to Rules.

Here are some of the modules that provide this functionality and a single-use UI:

http://drupal.org/project/taxonomy_theme
http://drupal.org/project/page_theme
http://drupal.org/project/content_theme
http://drupal.org/project/node_theme
http://drupal.org/project/smartphone_theme
http://drupal.org/project/switchtheme
http://drupal.org/project/themekey
hosais’s picture

Hi,

I would like to change the theme after the user login in.

I installed the lastest version of ThemeKey(6.x-1.2-beta1) and Rules(6.x-1.1).

By Rules, I can trigger user login but I cannot find the action to switch Theme. Do I need to add PHP code (for the action) myself?

Thank you.

hosais

mkalkbrenner’s picture

@hosais: You can easily implement that feature using ThemeKey. Just create a Theme Switching Rule like this:

Property: user:uid
Operator: >
Value: 0

fago’s picture

hm, I'm not sure it's a good idea to implement this directly as action, as this would only work when executed soon enough - but for most events it would be already too late. Perhaps best we can implement this feature by allowing actions to work only on a whitelist of events. Other opinions?

mkalkbrenner’s picture

@#6,fago:

That's why ThemeKey uses hook_init().

Please have a look at #647716: Integrate with Rules.
It seems to me that it's not a good idea to integrate both modules.

kevinquillen’s picture

Is there a way to load a particular CSS file in a theme? I have 1 theme with 7 CSS files depending on what path you are in. I don't want to load up a whole new theme, as it is just CSS additions to the base stylesheet.

amitaibu’s picture

@stripped your speech,

You can conditionally load the css in hook_init() based on the path (use menu_get_item() to get the path).

kevinquillen’s picture

In this module? Or my own?

amitaibu’s picture

@stripped your speech ,
Your own custom module

mitchell’s picture

Status: Active » Fixed
Issue tags: +rules integration, +theming

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

entrigan’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev

I think it is now possible to whitelist actions to specific events (fago's concern in #6). Setting back to active and updating version.