在plone.org上使用documentation以及論壇中的一些內容,我能夠在Plone 4.0.8中的內容下面獲得一個定製portlet管理器。實際上,目標是將4個自定義管理器安排在儀表板之下的內容之下。如何將庫存Portlet(從plone.app.portlets)添加到我的自定義Portlet管理器?
無論如何,我的經理只允許我添加靜態和收集portlet。在代碼中查看後,我發現當系統填充「添加新的portlet」下拉列表時,它會遍歷所有portlet。然後,它遍歷每個portlet的「for_」屬性檢查,以查看接口是否由自我提供 - 我的portlet管理器。
def getAddablePortletTypes(self):
addable = []
for p in getUtilitiesFor(IPortletType):
# BBB - first condition, because starting with Plone 3.1
#every p[1].for_ should be a list
if not isinstance(p[1].for_, list):
logger.warning("Deprecation Warning ..." % p[1].addview)
if p[1].for_ is None or p[1].for_.providedBy(self):
addable.append(p[1])
elif [i for i in p[1].for_ if i.providedBy(self)]:
addable.append(p[1])
return addable
如何將我的管理器接口添加到每個portlet的for_接口列表?
我改變了我的經理從接口 '類IBottomPortletManager(IPortletManager)' 到 '類IBottomPortletManager(IPortletManager,IColumn)' IColumn在plone.app.portlets定義的,所以這些門戶都已經註冊了提供IColumn的經理。 現在,這是做到這一點的理想方式嗎? – Travv15