A portal properties hook plugin lets you override a subset of
portal properties
dynamically. These properties define event actions, model listeners, validators,
generators, and content sanitizers. The
liferay-hook-7.0.dtd
file
lists this subset of properties.
Some portal properties accept multiple values. For example, the
login.event.pre
property defines action classes to invoke before login.
Deploying multiple hooks for properties like this appends the values to the
property’s current value. For example, multiple hooks that add login event
actions append their action classes to the portal instance’s login.event.pre
property. The
portal property reference
documentation shows
whether a property accepts multiple values by stating it or showing value lists
assigned to a default or example property setting.
Some portal properties accept a single value only. For example, the
terms.of.use.required
property is either true
or false
. Override a single
value property from one hook only–there’s no telling which value is assigned if
multiple hooks override it.
Here’s how to override a portal property using a Hook:
-
Create a Hook plugin using Liferay Developer Studio or Maven.
-
In the plugin’s
WEB-INF/src
folder, create aportal.properties
file and override properties with the values you want. -
In the plugin’s
WEB-INF/liferay-hook.xml
file, add the followingportal-properties
element as a child of thehook
element. Refer to theliferay-hook-7.0.dtd
file for details.<portal-properties>portal.properties</portal-properties>
-
Deploy the plugin.
You’ve modified the portal property. The Server Administration page’s Properties screen in the Control Panel shows your new property setting.