Reputation:
In most cases it is necessary to know Liferay portlet's actual name.
Particularly in Liferay's theme I can add "Login portlet" like the following:
$theme.runtime("58", "", $velocityPortletPreferences.toString())
And it works. But when I try to add some custom portlet with ID "some-portlet-id"
$theme.runtime("some-portlet-id", "", $velocityPortletPreferences.toString())
And it doesn't work. I suspect, that Liferay portlet's name doesn't equal to portlet's ID.
In this case could somebody explain me, how those names are generated?
Thanks in advance.
Upvotes: 5
Views: 5009
Reputation: 48067
In case you don't want to keep the documentation (or n1ckolas' answer) around and look up the actual portlet id (e.g. Liferay's numbers), you can also manually add the desired portlet to the page, then go to "Look&Feel/Advanced Styling" and you can see the portlet id there. If there's an INSTANCE, add some of your own random stuff to make it unique, but the more important part, the full portlet id, is easiest to find this way.
Upvotes: 1
Reputation: 4450
The thing, that portlet ID equals to portlet's name, if the portlet is within Liferay portal, i.e. ROOT
.
But if you trying to get name for the portlet within other war file (e.g. plugin environment), in this case portlet name is generated according this rule:
[portlet ID] + _WAR_ + [webapp name, where portlet is placed]
Please note, that both portlet ID
and webapp name
exclude -
from their names.
So, if you have portlet with id some-portlet-id
within WAR-file some-portlet
, so the portlet name is something like the following:
someportletid_WAR_someportlet
This also reffers to Liferay's themes names.
Also please keep in mind, that also Liferay portlet's name has optional instance ID:
[portlet ID] + _WAR_ + [webapp name, where portlet is placed] + _INSTANCE_ + [portlet instance ID]
They are necessary for those portlets, where instansable
is true. This is basically 4 arbitrary letters.
someportletid_WAR_someportlet_INSTANCE_abcd
But please be carefull with them, just because you can ignore that instance IDs and put everything you want. But if you need to get a particular instance with some pre-filled data (e.g. portlet preferences), you definitelly need to know that somehow.
Upvotes: 10