This project is read-only.

Theme settings

Topics: Writing themes
May 12, 2011 at 1:43 PM

In my theme, I need to be able to apply a site banner on a per tenant basis (inside the Branding.cshtml ideally).

There is documentation to indicate that it is possible (see below) but I can't see where the settings declared in the manifest of my Theme project should appear, and the extension method indicated in the docos "@Html.ThemePath" does not seem to be in the OrchardFramework project under the Orchard.Mvc.Html namespace.

Are theme settings currently supported?

May 12, 2011 at 1:55 PM

That second document is kind of a spec / discussion page rather than actual current documentation. So take what you find there with a pinch of salt :)

What you might want to do instead, is create a separate theme for each tenant, and have each inherit from a base theme (you can specify base theme in your Theme.txt). So then you can override specific bits of the theme as you need to per tenant.

May 12, 2011 at 2:12 PM
Edited May 12, 2011 at 2:12 PM

I don't think that's going to work for me as I'm likely to have twenty or so base templates with hundreds of tenants so the list of available templates with many looking incredibly similar will make it difficult for the people applying the templates to new tenants.  

I will already have a module that will support the extra functionality these tenants require.  Not entirely sure how to go about it but maybe I can access settings stored for the module from the Branding view template?

May 12, 2011 at 2:26 PM

In that case you could create a global setting in your module that specifies the URL of the site banner (assuming it's just a different image per client).

Or, you could use Mechanics and Media Garden and create a "SiteToBannerImage" connector which you could push into the header zone using the PaperclipPart and would therefore appear on every page. Wouldn't require any code, maybe just some template customization, not even much of that if your banner images are correctly sized to begin with. They're my projects so of course I'm biased as to where they're useful or not ;) But I can help you more with that if you need, they're quite new projects and lacking somewhat on the documentation front.

OR you could set up an Alternate template name for the Branding shape, based on the current tenant name - if you need full customization of the HTML (and you could extend this for any other shapes as well).

May 12, 2011 at 2:51 PM

Thanks for the info Pete, I'll probably go the route of a setting in the module as I'm already in that groove at the moment.

May 12, 2011 at 7:12 PM

Check out this theme, which shows how to do theme settings:

May 14, 2011 at 6:44 AM

That looks handy. Thanks.