Power Of WCM with Theme Development

Liferay provide advanced web content system that empower business users to configure and create Web Content. On other hand Liferay Theme plugin provide Configurable theme settings. This flexibility of web content management system used with theme can leverage additional power for Liferay Portal projects.

In theme there are sections like navigation, header and footer need regular changes like changing content and text of these sections. And on each change it requires development and deployment efforts. As we know Liferay Web Content Management system allows users to modify contents on the go. If we think Theme sections (Header, Footer and Navigation) as a web content. As localized web contents can be created, Business users can change localization Text anytime they want for links and text rather than adding them language properties and series of deployments through various environments. Also images used in Header Footer can be changed any time through Web Content without involvement of development Team.

By embedding web content in theme, these features can be achieved easily.

$journalContentUtil.getContent( $themeDisplay.getCompanyGroupId(), $webContentID, “”, $locale.toString(), $themeDisplay )

In the above code snippet $webContentID can be hardcoded as “HEADER. Now create web content “HEADER” using structure/template.

Sometimes there are situations when there is requirement that Business users want variety of Header, Footer and Navigation. In such situations Configurable Theme settings can be used for advanced control.

Liferay Provide configurable theme settings through which we can add some fields Text, Dropdown, and Radio. As an example take a case that user wants two Header Type and want to make it configurable

Step-1:-In this case create two web content (HEADER_TYPE_1 and HEDAER_TYPE_2) .

Step-2:-Add configurable setting in theme as follows.

<theme id="theme_id" name="Theme-Name">
    <settings>
        <setting configurable=”true” key="header-type" value="HEADER_TYPE_1" type=”Text”/>
    </settings>
</theme>

 Step-3:-And embed the web content in theme using the theme-setting value as follows.

#set($articleID=$theme.getSetting(“header-type”))
$journalContentUtil.getContent( $themeDisplay.getCompanyGroupId(),$articleID ,””, $locale.toString(), $themeDisplay)

Step-4:- When required you can change theme setting from HEADER_TYPE_1 to HEADER_TYPE_2 as shown below by navigating to theme settings.

SUMMARY

With use of configurable theme settings provide the benefit of selecting choice of different Section (Header, Footer, Navigation) Content for different pages by using single theme plugin as well as ease of modifying the content whenever required from the control panel using the web content management.