Fórum

How to determine whether to use Hook or an EXT

Ria K, modificado 7 Anos atrás.

How to determine whether to use Hook or an EXT

New Member Postagens: 6 Data de Entrada: 17/05/16 Postagens Recentes
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
Neil Griffin, modificado 7 Anos atrás.

Moved to Liferay Portal - English - Development

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
Moved to Liferay Portal - English - Development
thumbnail
Andrew Jardine, modificado 7 Anos atrás.

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

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
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
Ria K, modificado 7 Anos atrás.

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

New Member Postagens: 6 Data de Entrada: 17/05/16 Postagens Recentes
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
Andrew Jardine, modificado 7 Anos atrás.

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

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
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
David H Nebinger, modificado 7 Anos atrás.

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

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
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.
Ria K, modificado 7 Anos atrás.

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

New Member Postagens: 6 Data de Entrada: 17/05/16 Postagens Recentes
Thanks Andrew and David,
I really appreciate you taking time to answer