Edit Theme Switcher for plone.app.theming
How to switch off plone.app.theming for editing.
Now with plone.app.theming we are in the lucky situation to deliver really any design with Plone.
But there are also designers out in the wild creating designs not compatible with Plones edit-mode.
So its sometimes easier to edit in the classic Plone UI (Sunburst Theme) using a different web address for editing.
And here is how to do it:
- Consider to configure two adresses http://edit.domain.tld and http://www.domain.tld
- Add a subscriber to zope.app.publication.interfaces.IBeforeTraverseEvent to configure.zcml
<configure ... ... <subscriber for="* zope.app.publication.interfaces.IBeforeTraverseEvent" handler=".subscriber.surpress_theme" /> </configure>
- Add a file subscriber.py with code to conditionally set the header X-Theme-Disabled: True in case of edit domain (you may want to improve the condition).
def surpress_theme(obj, event): if event.request['ACTUAL_URL'].startswith('http://edit.'): event.request.response.setHeader('X-Theme-Disabled', 'True')
- Restart your instance
To test this on localhost just add something like edit.localhost to your /etc/hosts file for 127.0.0.1 and enter http://edit.localhost/Plone in your browser.
Image by karlbirrane at flickr under a CC-BY-SA license