Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Andrzej Drozdowski
How to switch a theme for site programitically
December 16, 2012 11:50 PM
Answer

Andrzej Drozdowski

Rank: Junior Member

Posts: 25

Join Date: September 3, 2010

Recent Posts

Hi,
I am developing a wizard that creates a site. I have a few site templates and a few themes.
I would like a user to choose one of the site templates and one of the themes.

I have managed to create the site but I have not idea how to switch the site theme.
Can you give me some advice?

Regards
A.D.
Milen Dyankov
RE: How to switch a theme for site programitically
December 17, 2012 5:23 AM
Answer

Milen Dyankov

LIFERAY STAFF

Rank: Regular Member

Posts: 222

Join Date: October 30, 2012

Recent Posts

The theme is applied separately to private and/or public pages. Internally those are called layout sets and thus represented by LayoutSet class and appropriate services (like LayoutSetLocalServiceImpl). Please have a look in the source code for examples of how to change the theme.
Rahul Sharma
RE: How to switch a theme for site programitically
December 17, 2012 5:58 AM
Answer

Rahul Sharma

Rank: Junior Member

Posts: 60

Join Date: January 10, 2012

Recent Posts

Hi,

You can achieve this by using themeDisplay.getLayout().setTheme() and LayoutLocalServiceUtil.updateLayout(), to commit changes.

Hope this will help you !
Milen Dyankov
RE: How to switch a theme for site programitically
December 20, 2012 8:57 AM
Answer

Milen Dyankov

LIFERAY STAFF

Rank: Regular Member

Posts: 222

Join Date: October 30, 2012

Recent Posts

Rahul Sharma:
Hi,

You can achieve this by using themeDisplay.getLayout().setTheme() and LayoutLocalServiceUtil.updateLayout(), to commit changes.

Hope this will help you !


This will work for current page. The question was about applying theme to a site.