How to hide some paths while browsing using the XType browsefield?

江枫思渺然 提交于 2019-12-01 09:43:45

问题


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/

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


回答1:


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.

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/



来源:https://stackoverflow.com/questions/26605695/how-to-hide-some-paths-while-browsing-using-the-xtype-browsefield

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!