问题描述
如何将自定义portlet添加到控制面板的Portal
部分,如下图所示:
How can I add a custom portlet to the Portal
section of the Control Panel, as shown in the following figure:
推荐答案
以下是操作方法:
-
在portlet的
liferay-portlet.xml
中(您可以检查 DTD 有关其他标签的更多信息),在<portlet>
标签中包括两个标签,如下所示:
In your portlet's
liferay-portlet.xml
(you can check the DTD of this xml for more information on other tags) include two tags in your<portlet>
tag as shown:
<portlet>
<portlet-name>MyCustomPortlet</portlet-name>
<icon>/mycustom.png</icon>
<!--
These are the two entries which are required for the portlet
to appear in the control panel
-->
<!--
Set the control-panel-entry-category value to "my", "content",
"portal" or "server" to make this portlet available in the
Control Panel under that category.
-->
<control-panel-entry-category>portal</control-panel-entry-category>
<!--
Set the control-panel-entry-weight value to a double number
to control the position of the entry within its Control Panel
category. Higher values mean that the entry will appear lower
in the Control Panel menu.
-->
<control-panel-entry-weight>100</control-panel-entry-weight>
<instanceable>false</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>mycustomportlet-portlet</css-class-wrapper>
</portlet>
此外,如果您不希望Portlet出现在Add Menu
中,以便不将其放置在其他页面上,那么在您的liferay-display.xml
中,您可以包括:
Also, if you don't want your portlet to appear in the Add Menu
so that it is not put on other pages, then in your liferay-display.xml
you can include:
<display>
<category name="category.hidden">
<!--
Adding your portlet to the hidden category would not display
the portlet in the ADD Menu on the top-left-hand corner
-->
<portlet id="MyCustomPortlet"></portlet>
</category>
</display>
构建并部署您的portlet,一切顺利.
Build and deploy your portlet and you are good to go.
这篇关于如何在“控制面板"部分中添加自定义portlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!