Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Adding Widgets to Page Fragments
Sorry if this is obvious ...
Question: Where/how do I find the registered Alias for each widget?
For example, I have tried to add <lfr-widget-login></lfr-widget-login> for the Login Widget, but the screen simply displays — "There is no widget available for alias login".
I don't know how to find the correct registered Alias for each widget/portlet.
Thanks in advance.
Nick
Question: Where/how do I find the registered Alias for each widget?
For example, I have tried to add <lfr-widget-login></lfr-widget-login> for the Login Widget, but the screen simply displays — "There is no widget available for alias login".
I don't know how to find the correct registered Alias for each widget/portlet.
Thanks in advance.
Nick
What I found out about this:
BUT, there is an alternative way to get a portlet into a page fragment (which even gives you the opportunity to preconfigure it -- just omit the preferences parts if you don't need that):
- Browse to https://github.com/liferay/liferay-portal
- Press T
- Enter the Portlet Class file name("LoginPortlet.java")
- Look for the value of the @Component property "com.liferay.fragment.entry.processor.portlet.alias"
- Prefix that value with "lfr-widget-", then you've got your tag name.
- Realize that the @Component property for LoginPortlet from step 4 is not there.
- Go to https://issues.liferay.com and file a bug.
- Wait one or two Liferay releases.
- Redo 1-5, then continue developing.
BUT, there is an alternative way to get a portlet into a page fragment (which even gives you the opportunity to preconfigure it -- just omit the preferences parts if you don't need that):
[code]<div class="fragment-12345">
[#assign assetPublisherPortletPreferences="<portlet-preferences>
<preference>
<name>delta</name>
<value>12</value>
</preference>
</portlet-preferences>" /]
[@liferay_portlet["runtime"]
instanceId="${fragmentEntryLinkNamespace}assets"
portletName="com_liferay_asset_publisher_web_portlet_AssetPublisherPortlet"
defaultPreferences="${assetPublisherPortletPreferences}"
/]
</div>
The info that's nowhere to be found (unless you read Liferays source code) is that Page Fragments' HTML actually is processed by Freemarker, but only Freemarkers alternative syntax is allowed here. So, we can make use of Liferay taglibs here, which puts the tag <liferay-portlet:runtime> </liferay-portlet:runtime>
in our reach.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™