Overwrite my profile portlet in liferay 7.0 ga3

282 views Asked by At

I'm trying to overwrite my profile portlet in Liferay, I read that I can do it with hooks, but I can't find the original .jsp, of this portlet.

and in the documentation: https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/overriding-a-modules-jsps they mention the Fragment-Host

Fragment-Host: com.liferay.login.web;bundle-version="[1.0.0,1.0.1)"

but someone knows which is the fragment host of my profile? and where I can find the original code of the .jsp?

1

There are 1 answers

2
Olaf Kock On BEST ANSWER

When you add the portlet to a page, go to "Look and Feel"/"Advanced CSS" and look at the portlet ID that's noted there for this portlet. It looks like portlet_com_liferay_contacts_web_portlet_ProfilePortlet_INSTANCE_KXj9dBbRgJFs. This gives you a hint to where the portlet is implemented, and this should give you enough hints to locate any portlet that you'd like to customize.

Liferay's coding standard typically explicitly defines the portlet id, so grepping the source code for com_liferay_contacts_web_portlet_ProfilePortlet, then uses of this constant, should easily locate the implementation. (Note: It's not that I'm not giving you the answer here because I don't want to, but rather because I don't have the 7.0 GA3 source code downloaded currently)

In a related note: Hooks were "the old" way of overriding a JSP within Liferay's core up to 6.2 - You shouldn't use that any more from Liferay 7 on, especially as many JSPs now are in plugins anyway, so hooks couldn't grab them. The approach with JSP Fragments is right. You'll need to address the exact version that you find in Liferay - which should be well documented in the documentation on how to build Fragments.