Ticket #13713 (new Bug)

Opened 3 years ago

plone.theme can't work with dynamic skins

Reported by: frisi Owned by:
Priority: minor Milestone: 4.x
Component: Unknown Version: 4.2
Keywords: Cc:

Description

usecase

i want to have different skins on my portal depending on the urls used to access it.

ie. to have a customized language selection viewlet on the themed site (public facing), and the standard one on the cms domain

setup:

portal_skins

allow arbitrary skin selection and set request variable to HTTP_PLONE_SKIN default skin is set to "Sunburst Theme", register 'my.skin' selection

configure nginx/apache to set the request header for the public facing virtual host (eg. for nginx)

proxy_set_header plone_skin 'my.skin';

expected behaviour

when i access the public domain, plone.theme should make the request provide the interface registered for 'my.skin'

    <interface
        interface=".interfaces.IThemeSpecific"
        type="zope.publisher.interfaces.browser.IBrowserSkinType"
        name="my.skin"
        />

instead, the sunburst layer is applied

the problem

plone.theme calls Products.CMFCore.Skinnable.getCurrentSkinName to find out which portal_skins selection is the currently used and looks up the corresponding layer interface

getCurrentSkin uses uses the SKINDATA property that is setup by setupCurrentSkin

too bad, setupCurrentSkin is called *after* getCurrentSkinName in this case :-(

workaround

calling setupcurrentskin before asking for the currentskin in plone.theme.layer.mark_layer would solve the problem:

    if portal_skins is not None:
        site.setupCurrentSkin(event.request)
        skin_name = site.getCurrentSkinName()
        skin = queryUtility(IBrowserSkinType, name=skin_name)
Note: See TracTickets for help on using tickets.