plone - 防止某些类型出现在 plone.app.theming 的文件夹列表中

标签 plone theming diazo

我有一个网站,它有一个通过 plone.app.theming/Diazo 主题显示的公共(public) url,并且 url 仅限于通过 sunburst 显示的内容编辑器。

我希望某些门户类型只出现在 cms 编辑器的列表中,而不出现在公共(public)站点上。我注意到 folder_listing 模板使用 request/contentFilter如果定义。有没有办法为主题 View 的请求添加内容过滤器?

最佳答案

我最终使用 Plone 站点上的预遍历钩子(Hook)解决了这个问题。这对我来说很有效,因为我可以根据请求的某些属性可靠地确定请求是针对主题 View 还是针对编辑 View 。

def SetupThemeView(site, before_traverse):
    """ If we're serving the public, themed, version then supplement the request
    """
    request = before_traverse.request
    if serving_theme_view(request):
        request.set('contentFilter', {'portal_type' : listable_types})

在哪里 serving_theme_view确定我们是否提供主题或编辑器 View 和listable_types是我们希望出现在主题 View 列表中的类型名称的元组。

然后我在我的 configure.zcml 中将其注册为订阅者

<subscriber
    for="Products.CMFCore.interfaces.ISiteRoot
         zope.traversing.interfaces.IBeforeTraverseEvent"
    handler=".events.SetupThemeView"
    />

关于plone - 防止某些类型出现在 plone.app.theming 的文件夹列表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10427220/

相关文章:

plone - 如果您移动图像或目标页面,Plone 上的链接会更新吗? (4.3.4.1)

javascript - 如何在一个 Angular 组件中处理多个主题?

php - 尝试使用快速邮件程序从节点访问值以在电子邮件模板中呈现

plone - 是否可以在 Diazo <notheme if-path=... 规则中指定通配符?

plone - 在 content-children 之后插入标签

Python 和 Plone 帮助

python - 将基于 zcml 的 python 脚本转换为 zope/plone 中的独立脚本

plone - 如何为经过身份验证的用户组禁用 Plone 5 工具栏?

jquery - 如果我想让一个页面有一个主题滚动器(或多或少像 jQuery themeroller),它应该如何工作

themes - Plone 4.2 - 如何更改 Diazo 主题中的 Logo ?