Overriding Portal Properties Dynamically

A portal properties hook lets you override a subset of portal properties that define event actions, model listeners, validators, generators, and content sanitizers. The liferay-hook-6.2.dtd file lists these properties.

Some portal properties accept multiple values. For example, the login.event.pre property lets you define multiple action classes to invoke before login. Deploying multiple hooks that set such a portal property 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. Refer to the portal property reference documentation to determine whether a property accepts multiple values. The property description might explicitly mention it or show 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. Modify single value properties from one hook only; otherwise there’s no telling which value will be assigned.

Here’s how to override a portal property using a Hook:

  1. Create a Hook plugin using Liferay @[email protected], the Plugins SDK, or Maven.

  2. In the plugin’s WEB-INF/src folder, create a portal.properties file and override properties with the values you want.

  3. In the plugin’s WEB-INF/liferay-hook.xml file, add the following portal-properties element as a child of the hook element. Refer to the liferay-hook-6.2.dtd file for details.

    <portal-properties>portal.properties</portal-properties>
    
  4. 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.

Related Topics

Portal Properties Reference

Creating Plugins using Liferay @[email protected]

Creating Plugins using the Plugins SDK

Creating Hook Plugins using Maven

0 (0 Votes)
Creating Plugins to Extend Plugins Previous