Applying Portlet Decorators to Embedded Portlets

Once you have installed a theme that contains Portlet Decorators, site administrators can apply them to a portlet instance by selecting the Application Decorator in the Look and Feel Configuration dialog.

If your theme contains embedded portlets, it’s also possible to apply an Application Decorator other than the default one by setting its preferences.

This tutorial demonstrates how to apply Portlet Decorators to Embedded Portlets in your theme.

Setting Application Decorator Preferences

To define a default Application Decorator for your theme’s embedded portlets, you must set a default decorator in the portlet preferences.

For example, the Classic theme declares an Application Decorator with Id barebone and applies it to the embedded Navigation Menu portlet and Search portlet in its navigation.ftl:

<#assign VOID =

<div aria-expanded="false" class="collapse navbar-collapse"
    <#if has_navigation && is_setup_complete>
	    <nav class="${nav_css_class} site-navigation"
	    id="navigation" role="navigation">
		    <div class="navbar-form navbar-right" role="search">
			    < default_preferences=
			    "${freeMarkerPortletPreferences}" />

		    <div class="navbar-right">
			    <@liferay.navigation_menu default_preferences=
			    "${freeMarkerPortletPreferences}" />

<#assign VOID = freeMarkerPortletPreferences.reset()>

To set the default decorator for your embedded portlets, follow these steps:

  1. Set the value for the portletSetupPortletDecoratorId to the Id of the Application Decorator you want to use:

    <#assign VOID =
  2. Next, set the default_preferences attribute of the portlet’s tag to the freeMarkerPortletPreferences variable you just defined:

    < default_preferences= "${freeMarkerPortletPreferences}" />

Your embedded portlets now have a custom default Application Decorator!

Embedding Portlets in Themes

Providing Portlets to Manage Requests

« Adding Portlet Decorators to a ThemeTheming Portlets »