掲示板

How to determine whether to use Hook or an EXT

7年前 に Ria K によって更新されました。

How to determine whether to use Hook or an EXT

New Member 投稿: 6 参加年月日: 16/05/17 最新の投稿
Hi,
I am very new to Liferay and trying to get the basic understanding of plugins and determine which plugin to use and when.
In regards to Hook and Ext, how is it determined which one to use:
1. Override a property file, I found definitions of properties here
(https://docs.liferay.com/portal/6.2/propertiesdoc/portal.properties.html), but how is it determined which property can be overridden by Hook and which one will need EXT
2. Is there a rule of thumb to determine when a JSP page can be overridden with Hook and what will need an EXT?
3. Does any core service that has service wrapper can be extended or overridden using Hook, else we need EXT

thanks in advance!!
thumbnail
7年前 に Neil Griffin によって更新されました。

Moved to Liferay Portal - English - Development

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
Moved to Liferay Portal - English - Development
thumbnail
7年前 に Andrew Jardine によって更新されました。

RE: How to determine whether to use Hook or an EXT

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Hi Ria,

There is just one rule of thumb to follow.

IF you can do it with a HOOK, then ALWAYS choose a hook over an EXT.

EXT, at one point in time, was the only way to do anything in Liferay. Fortunately the product has evolved (tremendously) and given us not just "hooks" but all sorts of kinds of hooks that allow us to alter and or augment a lot... A LOT.. of the portal.

There are occasions where you get stuck with an EXT plugin. How do you determine when that is? Well, as I said, when you CAN'T use a hook -- which most of the time is when you want to alter something that is part of the portal-impl.jar.

As for you question about the services -- there is a service wrapper hook that you can write that will allow you to override existing services -- check tis out :: https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/overriding-a-portal-service-using-a-hook
7年前 に Ria K によって更新されました。

RE: How to determine whether to use Hook or an EXT (回答)

New Member 投稿: 6 参加年月日: 16/05/17 最新の投稿
Thanks Andrew!!

I am guessing the scenarios "when you CAN'T use a hook" is something you learn with experience and researching and there is not always straight answer to it even for portal properties override emoticon
thumbnail
7年前 に Andrew Jardine によって更新されました。

RE: How to determine whether to use Hook or an EXT

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Experience is pretty much always everything. Best advice I can offer is to take advantage of the forums when you have questions. There is almost certainly someone else who has asked your question before. If they haven't, then ask away and almost certainly someone will answer with some best practices/guidance/examples.
thumbnail
7年前 に David H Nebinger によって更新されました。

RE: How to determine whether to use Hook or an EXT

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
The only times I've ever had to fall back to an EXT was to replace or extend a class from portal-impl.jar. Most other use cases (struts override, service replacement, jsp override) can be handled by hooks.
7年前 に Ria K によって更新されました。

RE: How to determine whether to use Hook or an EXT

New Member 投稿: 6 参加年月日: 16/05/17 最新の投稿
Thanks Andrew and David,
I really appreciate you taking time to answer