Setting a Default Widget Template
You can change the widget template for individual widgets through their own configuration; however you can also configure a default widget template to apply to all widgets of a particular type. To do this, go to Control Panel → System Settings. In System Settings you can find a configuration for every widget in Liferay DXP. Widgets that support widget templates have a Display Style Group ID and a Display Style option.
Display Style Group ID: The Site ID where the widget template is located. For Global templates use 0 for the ID.
Display Style: The widget template’s key.
To enter a Display Style, you first need the Template Key for the template you want to use. To get the Template Key, go to the Application Display Template list for a given Site and retrieve it from the widget template listing. Then enter the display style as ddmTemplate_[template-key]
.
Default Widget Template Example
For example, configure the Language Selector widget templates like this:
-
Open the Home → Design → Widget Templates.
-
Click Add () and select the option Language Selector Template.
-
Open Details and find the Template Key -
LANGUAGE-ICON-FTL
Now that you have the ID, you can change the template from System Settings.
-
Go to Control Panel → Configuration → System Settings.
-
Find Localization under the Platform heading and select Language Selector from the options on the left.
-
In the Display Style field, enter
ddmTemplate_LANGUAGE-ICON-FTL
.
Now any Language Selector widgets are added to a page use the new defaults.
Setting a new default widget template does not affect any widgets that are already added to a page and have a configured widget template.