フォーラム

ホーム » Liferay IDE » English

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Etien Rožnik
Hook for portal properties not working as expected
2013/03/18 5:22
答え

Etien Rožnik

ランク: New Member

投稿: 2

参加年月日: 2012/11/07

最近の投稿

Hi,

im trying to make a hook for overriding a property in the properties of liferay(the property for the menu in the My Account portlet)

I've made the hook trought the Eclipse IDE, and added the property to change to the portal.properties like this:
1users.form.my.account.miscellaneous=announcements,display-settings,comments


The properties file is in the WEB-INF/src folder.

The liferay-hook.xml is in the WEB-INF folder:
1<?xml version="1.0"?>
2<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.1.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_1_0.dtd">
3
4<hook>
5    <portal-properties>portal.properties</portal-properties>
6</hook>



The problem is that, the hook does not remove the menu item that i'm trying to remove.. if i change the property in the portal-ext.properties it works just fine, if i set the property to nothing in the ext properties, the hook works fine, if i just add a menu item in the property, the hook works fine, it just does not want to remove the default item.

Thanks for the help!
Hitoshi Ozawa
RE: Hook for portal properties not working as expected
2013/03/18 5:42
答え

Hitoshi Ozawa

ランク: Liferay Legend

投稿: 7949

参加年月日: 2010/03/23

最近の投稿

You're not suppose to "hook" portal.properties because they only hold "default" values. You'll suppose to create a portal-ext.properties file.
Dave Weitzel
RE: Hook for portal properties not working as expected
2013/03/18 8:05
答え

Dave Weitzel

ランク: Regular Member

投稿: 203

参加年月日: 2009/11/18

最近の投稿

It is perfectly OK to override portal.properties using a hook - in fact for user profile type changes this is the recommended route in training and other documentation.
are you sure you are accessing the My Account portlet and not the user update one?

users.form.update.miscellaneous is the property that admin on the control panel will take note of you need to set both.

I'm not sure if this behavior is a result of the bug in GA2 to do with the loading sequence of portal.properties, See http://issues.liferay.com/browse/LPS-29904
That certainly effects the portal-ext.properties but not sure how hooks and other plugins are changed.
Mika Koivisto
RE: Hook for portal properties not working as expected
2013/03/18 10:53
答え

Mika Koivisto

LIFERAY STAFF

ランク: Liferay Legend

投稿: 1512

参加年月日: 2006/08/07

最近の投稿

With hook you can't delete existing values you can only add new ones. If you need to remove some elements just use portal-ext.properties for that.

For some properties the hook used to replace the values on some Liferay version but that was a bug.
Etien Rožnik
RE: Hook for portal properties not working as expected
2013/03/19 1:03
答え

Etien Rožnik

ランク: New Member

投稿: 2

参加年月日: 2012/11/07

最近の投稿

Thanks for the answers!

Im using the "My account" tab in the liferay Control Panel..


So i'm supposed to edit the portal-ext.properties to remove some fields?

p.s. im using the latest version of LR portal (6.1 CE GA2)

Thank!