Setting Default Preferences for an Embedded Portlet

Follow these steps to set default portlet preferences for an embedded portlet:

  1. Retrieve portlet preferences using the freeMarkerPortletPreferences object. The example below retrieves the barebone:

    <#assign preferences = freeMarkerPortletPreferences.getPreferences(
      "portletSetupPortletDecoratorId", "barebone"
    ) />
    
  2. Set the defaultPreferences attribute of the embedded portlet to the freeMarkerPortletPreferences object you just configured:

    <@liferay_portlet["runtime"]
        defaultPreferences="${preferences}"
        portletName="com_liferay_login_web_portlet_LoginPortlet"
    />
    

Below are some additional attributes you can define for embedded portlets:

PreferenceDescription
defaultPreferencesA string of Portlet Preferences for the application. This includes look and feel configurations.
instanceIdThe instance ID for the app, if the application is instanceable.
persistSettingsWhether to have an application use its default settings, which will persist across layouts. The default value is true.
settingsScopeSpecifies which settings to use for the application. The default value is portletInstance, but it can be set to group or company.

Now you know how to set default preferences for embedded portlets!

« Embedding a Portlet by Portlet NameImporting Resources with a Theme »
この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています