如何查找定义 portlet 的文件夹?
我正在创建新闻和事件 portlet 的自定义版本,它将仅显示其定义位置下游(而不是站点范围内)的内容项。
这个想法是为了让我们站点中的某些组能够创建只显示其下游文件夹层次结构中的项目的新闻和事件 portlet。
替换
portal_state.navigation_root_path()
为
path='/'.join(context.getPhysicalPath())
本质上,我在视图的目录查询中将
我运行的问题context.getPhysicalPath() 是根据查看 portlet 的位置而不是定义 portlet 的位置来评估的。一旦有人从顶级组文件夹向下游导航,他们通常会得到一个空的或消失的 portlet。
如何查找定义 portlet 的文件夹,以便将其作为上下文传递?
I'm creating custom versions of the News and Events portlets which will show only content items from downstream of where they are defined (rather than sitewide).
The idea is for for certain groups in our site to be able to create news and events portlets that only show the items from their downstream folder hierarchy.
Essentially, I swapped out
portal_state.navigation_root_path()
for
path='/'.join(context.getPhysicalPath())
in the view's catalog query
The problem I'm running into, is that context.getPhysicalPath() is evaluated based on where the portlet is being viewed, not the the location where the portlet was defined. Once someone navigates downstream from the top-level group folder, they often end up with an empty or disappearing portlet.
How do I look up the folder on which the portlet is defined so that I can pass that as my context?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您想要
__portlet_metadata__['key']
:I think you want the
__portlet_metadata__['key']
: