djay
djay

Reputation: 1058

switch diazo (plone.app.theming) themes based on cookie

I'd like to be able to enable administrators to change which theme is currently being used just for them. Possibly by setting a cookie, or special url. This will enable them to be able to debug a copy of their theme while another version is live for everyone else.

Upvotes: 3

Views: 358

Answers (3)

Torkel
Torkel

Reputation: 138

I've made something similar that uses the hostname to decide which diazo theme to use. There was no problems having a different rules.xml, index.html and custom resources. The themingplugins was another story (overrides, views, browserlayer etc), I don't know how good it is to register/unregister themingplugins on each request.

I'll update this comment when I get home so you can see what I did. If I remember correctly I subclassed and replaced something registered from plone.app.theming (the component that applies the theme).

Upvotes: 1

fRiSi
fRiSi

Reputation: 1238

i did not try this out but it could possibly work this way:

define a parameter for the currently used theme. note that you'll need to enable "Allow arbitrary skins to be selected" in portal_skins/manage_propertiesForm

[theme:parameters]
theme = python:self.context.REQUEST.get('plone_skin', 'Plone Default')

and select the theme or ruleset based on this parameter in your rules.xml

<theme href="theme1.html" if="$them = 'special theme'"/>
<theme href="default.html" if="$them = 'Plone Default'"/>

Upvotes: 0

Laurence Rowe
Laurence Rowe

Reputation: 2999

Supporting this would require work on plone.app.theming so that different diazo themes could be configured for different CMF skins. It's on my roadmap, but I don't know when I'll get to it. Contact me if you're interested in working on this feature or sponsoring it.

Upvotes: 3

Related Questions