使用 XType 浏览域浏览时如何隐藏一些路径? [英] How to hide some paths while browsing using the XType browsefield?

查看:14
本文介绍了使用 XType 浏览域浏览时如何隐藏一些路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的组件对话框中,我使用 browsefield XType 使用户能够浏览页面树并选择一个页面:

In my component dialog, I use browsefield XType to enable the user to browse through the page tree and select a page:

<page jcr:primaryType="cq:Widget" 
      fieldLabel="Page"
      name="./path" 
      xtype="browsefield" />

同时,我想让一些页面不可见.假设我有以下结构:

At the same time, I would like to make some pages are invisible. Suppose I have the following structure:

pages/
    page1/
        page1_1/
        page1_2/

如何让pages/page1/page1_2不可见,这样在浏览页面树的时候没人能选择?

How do I make pages/page1/page1_2 invisible, so that nobody can select it when he browses through the page tree?

推荐答案

browsefield 是一个已弃用的 xtype,它正在替换 pathfield 有这个功能.Pathfield 有一个名为 predicate 的属性,可用于过滤.您可以创建和注册一个自定义谓词,该谓词对于您不希望在对话框中显示的路径返回 false.然后可以将自定义谓词的名称传递给路径字段的配置.

browsefield is a deprecated xtype, it's replacement the pathfield has this feature. Pathfield has a property called predicate which can be used for filtering. You can create and register a custom predicate that returns false for the paths you don't want to be visible in the the dialog. The name of the custom predicate can then be passed to the config of pathfield.

您可以在此处找到详细教程:http://www.albertoalmagro.com/2013/05/adobe-cq5-create-predicate-pathfield.html

You can find a detailed tutorial on this here : http://www.albertoalmagro.com/2013/05/adobe-cq5-create-predicate-pathfield.html

有关谓词的更多信息,可以参考以下链接:

For more on predicates, the following links can be referred :

http://www.wemblog.com/2013/04/how-to-create-custom-query-predicate-in.html

http://labs.sixdimensions.com/blog/2013-07-10/custom-predicateevaluators-or-how-i-learned-stop-worrying-and-love/

这篇关于使用 XType 浏览域浏览时如何隐藏一些路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆