Overriding Portal Properties using a Hook

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:

  1. Create a Hook plugin using Liferay Developer Studio 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-7.0.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.

Portal Properties Reference

Server Administration

Liferay Developer Studio

Generating New Projects using Maven Archetypes.

« Overriding Language KeysOverriding MVC Commands »
Este artigo foi útil?
Utilizadores que acharam útil: 0 de 0