How to put a portlet on the theme that will have the same configuration and appearance on all pages.

  • File ‘theme_file.vm’.
    add following strings:

#set ($portletName = “portlet_name”)
#set ($queryString = “param1=value1&..&paramN=valueN”)
#set ($preferences = “
<portlet-preferences>[<preference><name>_name_</name><value>_value_</value></preference>]*</portlet-preferences>”)
$taglibLiferay.runtime($portletName, $queryString, $preferences)

          Note: properties ‘queryString’ and ‘preferences’ can be empty

  • File ‘portlet-ext.xml’.
    Add tag <portlet/> and fill its.
    Here you can define <portlet-preferences/> (instead of long and unreadable string above), e.g.

<portlet-preferences>
   
<preference>
     
<name>portlet-setup-show-borders</name>
     
<value>false</value>
   
</preference>
</portlet-preferences>

  • File ‘liferay-portlet-ext.xml’
    Add tag <portlet/> and fill its.
    You should add next two important strings inside this tag:

<preferences-unique-per-layout>false</preferences-unique-per-layout>
<preferences-owned-by-group>false</preferences-owned-by-group>

And now liferay will use the same configuration for all pages and user can configure it anywhere.

Note: anyway Liferay creates new record for all pages in table ‘PORTLETPREFERENCES’.
I guess it was made if you wish to modify the appearance of portlet for any page.