First, you’ll need to identify the theme elements you want to make configurable. In the case of the Lunar Resort, you want to make the Breadcrumbs, Portlet borders, and Page Title elements configurable.
Now that you know the elements you want to give Administrators control of, you can get started.
Making configurable theme settings involves a multi-step process. First, you’ll
need to add the theme settings to
liferay-look-and-feel.xmllocated in your
Add the following code below
<settings> <setting configurable="true" key="show-breadcrumbs" options="true,false" type="select" value="false" /> <setting configurable="true" key="portlet-setup-show-borders-default" options="true,false" type="select" value="true" /> <setting configurable="true" key="show-page-title" options="true,false" type="select" value="true"/> </settings>
The code you just added identifies the theme settings for the theme. Each setting has a few attributes in common. The
configurableattribute defines whether the setting is configurable by the user.
keyrefers to the language key that identifies the theme setting. The
optionsattribute sets the options for the select menu.
typerefers to the type of UI to render to control the theme setting. Finally, the
valueattribute sets the default value for the theme setting.
Although you can create custom theme settings using your own
key, you can also make existing theme settings user configurable. The
portlet-setup-show-borders-defaultis an existing theme setting that has been made user configurable for the Lunar Resort.
Save the file and wait for the changes to publish.
Sign in to the Portal as an Admin and navigate to Admin → Site Administration → Pages.
Select the Settings drop-down panel. The theme settings you just configured are now available.
The steps you’ve completed so far have added the custom theme settings to the
Look and Feel menu for the theme. In order to make them actually work, you’ll
have to assign their values in
init_custom.ftl. You’ll do this next.