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?
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
来源:https://stackoverflow.com/questions/26605695/how-to-hide-some-paths-while-browsing-using-the-xtype-browsefield